-
Notifications
You must be signed in to change notification settings - Fork 295
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
Supported property names for NamedNodeMap #141
Comments
Per the current definition you would get duplicates, but that does not seem to be what browsers do. @bzbarsky, should I just add a statement to exclude duplicates here? Note that Chrome does not even list the property names for |
(That |
Yep, this Edit: BZ noticed earlier that Chrome has bug for NamedNodeMap #104 (comment) |
Probably good enough, yes, as long as order is clearly defined. Certainly that's all Gecko does in practice. See https://hg.mozilla.org/mozilla-central/file/d7a0ad85d9fb/dom/base/nsDOMAttributeMap.cpp#l219 for the implementation as of today.
There are all sorts of bugs around |
So I didn't know why we wanted to change this, but from https://tc39.github.io/ecma262/#sec-invariants-of-the-essential-internal-methods it seems clear enough. Only property keys observable through |
The list should in theory include all names which return something other than This actually kinda sucks; due to the lowercasing behavior this means that all possible uppercasings should be in the list, or something. That seems fairly undesirable, not to mention probably not so web-compatible. Now the good news is that since named props can't be made non-configurable and objects with such props can't be made non-extensible there isn't actually a violation of the spec section you cite here if we just have |
I think we would also need to add something that ensures these objects cannot be made non-extensible, as otherwise you could do
clause. (That clause is admittedly a bit ambiguous; it seems like it's trying to place an upper bound, but the phrasing "all own properties" seems to imply a lower bound too.) It looks like making properties non-configurable is guarded against already in the platform object [[DefineOwnProperty]] definition. If this is taken care of then I agree there is no invariant violation (just a slightly-annoying mismatch). |
|
Ah, I see, it's just defined by monkeypatching Object.preventExtensions and friends instead of by overriding the appropriate internal method. Someone should fix that… |
I don't have deep knowlage around all ECMAScript stuff so I have to ask, in this example (test in Firefox):
Returning "A:new" by |
No, that seems bogus. Looks like getOwnPropertyNames should only return lowercased versions of names, right? |
Or maybe skip them when we have element in HTML namespace and owner is HTML Document (I mean all attr's names what have minimum one capital letter because, what I see now, This all exist because using setAttributeNS() for element in HTML namespace and owner is HTML Document. In other cases it is more predictable.
|
If we return the lowercased version of the attribute, it would still be wrong, since I think what we need to do is check This will require changes to Gecko as currently it does return uppercase attribute names. It will also require changes to other browser for unrelated changes. Once we fix this we should also file a bug against wpt. Does that make sense @bzbarsky? |
Ah, indeed. That makes sense, yes. |
Note that I'll add a web platform test in the Gecko bug. |
https://dom.spec.whatwg.org/#dom-namednodemap-item
"A NamedNodeMap object’s supported property names, all unenumerable, are the qualified names of the attributes in the attribute list, in order."
But these supported property names must be all qualified names of the attributes in the attribute list? So for example we can have five attributes with qualified name
a:test
and different namespace and all of them belong to supported property names? If yes then what Object.getOwnPropertyNames() and DevTools should return (when inspect NamedNodeMap object), only first (or last) unique qualified name or all qualified names (including duplicates)?Small testcase:
The text was updated successfully, but these errors were encountered: