Skip to content

Add HTMLDocument.currentScript #4

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

Merged
merged 2 commits into from
Sep 21, 2018
Merged

Conversation

cprussin
Copy link
Contributor

Add bindings to Document.currentScript and Element.getAttribute().

Note that in an attempt to properly implement the note mentioned here regarding different DOM implementation handling for non existent attributes, the FFI code in this PR has slightly more logic than the trivial implementation. I don't know how you typically handle cases like this--if you care to target all DOM implementations, I think this is the right thing to do. If you only care to target later implementations, or if you think consumers should handle this check in purescript code, then I can make it trivial and maybe export a binding to hasAttribute as well? Let me know what you'd prefer here if you'd like modifications and I'm happy to oblige.

@cprussin
Copy link
Contributor Author

Friendly nudge @garyb . Any chance of getting it merged and released? Thanks!

Copy link
Member

@garyb garyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAttribute should be defined for Element in purescript-web-dom rather than HTMLElement in here, but this looks good otherwise!

@cprussin
Copy link
Contributor Author

@garyb removed, thanks. Didn't realize that it already existed elsewhere :)

@cprussin
Copy link
Contributor Author

FWIW is there any clear guideline on what goes in purescript-web-dom vs purescript-web-html? Seems like the border is a bit blurry to me.

@garyb
Copy link
Member

garyb commented Sep 21, 2018

So the border for what belongs where is definitely clear, but as to why what belongs where, it's definitely pretty arbitrary seeming 😄

@garyb garyb changed the title Add HTMLDocument.currentScript and HTMLElement.getAttribute. Add HTMLDocument.currentScript Sep 21, 2018
@garyb garyb merged commit e8a03b0 into purescript-web:master Sep 21, 2018
@cprussin
Copy link
Contributor Author

Oh, that's pretty clear 😆 . Thanks!

@garyb
Copy link
Member

garyb commented Sep 21, 2018

I think the main distinction is the types/interfaces in the DOM spec also apply to things like SVG documents.

@cprussin cprussin mentioned this pull request Sep 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants