Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Type of getElementById? #16

Closed
sharkdp opened this issue Aug 23, 2015 · 3 comments
Closed

Type of getElementById? #16

sharkdp opened this issue Aug 23, 2015 · 3 comments

Comments

@sharkdp
Copy link
Contributor

sharkdp commented Aug 23, 2015

Currently, getElementById is defined in the module DOM.Node.NonDocumentTypeChildNode with the following type:

getElementById :: forall eff. ElementId -> NonDocumentTypeChildNode -> Eff (dom :: DOM | eff) (Nullable Element)

Maybe I am misunderstanding something, but I don't think getElementById works on a single node level.. so I would rather expect this to be in DOM.Node.Document and to work on Document instead of NonDocumentTypeChildNode:

getElementById :: forall eff. ElementId -> Document -> Eff (dom :: DOM | eff) (Nullable Element)

See also: https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById

@garyb
Copy link
Member

garyb commented Aug 23, 2015

According to the DOM4 spec, this is correct: http://www.w3.org/TR/dom/#nonelementparentnode

Every Document is a NonDocumentTypeChildNode, and there is a coercion for it provided here.

@garyb
Copy link
Member

garyb commented Aug 23, 2015

Oh, sorry, I see the problem now... yes, looks like I made the same mistake implementing it as I did just describing it :)

The interfaces for NonDocumentTypeChildNode and NonElementParentNode have swapped implementations currently... thanks!

@sharkdp
Copy link
Contributor Author

sharkdp commented Aug 23, 2015

Well, I was also wrong, but that is the solution, yes. Thanks!

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

No branches or pull requests

2 participants