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
iterable declaration on NodeList is invalid #284
Comments
The iterable declaration on DOMTokenList has the same problem. |
It seems though that the iterator can never return null, right? Shouldn't we allow for the removal of nullability in that case? |
That's not at all obvious from the IDL. The interface says it has an indexed getter that can return null; the iterator will use the indexed getter internally, so can return null too. The fact that the indexed getter can't actually return null in this case is buried in prose. If the interface had:
then you could write Now maybe we should assume that anything with an indexed getter is lying about the getter being able to return null, because it's layering the getter on top of an accessor function which can in fact return null (but only calling it in cases when it can't). I'd have to do a really careful audit of all the 40-ish indexed getters in the platform before being willing to make that assumption, and it would be rather fragile if people add something new... |
Maybe it's not worthwhile since we don't want new APIs to use getters, but I might have a look before changing this IDL. |
NodeList has:
but http://heycam.github.io/webidl/#idl-iterable says:
In this case the types are different: one is
Node
and the other isNode?
.The text was updated successfully, but these errors were encountered: