Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isSubtypeOf "textual" #39

Open
paulyoung opened this issue Apr 7, 2015 · 3 comments
Open

isSubtypeOf "textual" #39

paulyoung opened this issue Apr 7, 2015 · 3 comments

Comments

@paulyoung
Copy link
Contributor

I would have expected these to return true:

isSubtypeOf "textual", "headline"
isSubtypeOf "textual", "h1"

Is there a reason why they don't?


(Previously asked in the-grid/poly/issues/13)

@bergie
Copy link
Contributor

bergie commented Apr 7, 2015

@paulyoung
Copy link
Contributor Author

This appears to be the reason it doesn't return true:

screen shot 2015-04-07 at 4 45 22 pm

This is how it's currently being used:

{isSubtypeOf} = require "flowerflip/lib/schema"

class Content
  ...
  _computeGetBlock: =>
    ...
    return (block) =>
      for type in isSubtypeOfs
        return false unless isSubtypeOf block.type, type
      ...
      true
  ...

@paulyoung
Copy link
Contributor Author

This works:

schema = require "flowerflip/lib/schema"

class Content
  ...
  _computeGetBlock: =>
    ...
    return (block) =>
      for type in isSubtypeOfs
        return false unless schema.isSubtypeOf.call schema, block.type, type
      ...
      true
  ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants