- From: David Flanagan <dflanagan@mozilla.com>
- Date: Tue, 29 Nov 2011 10:17:26 -0800
- To: www-dom@w3.org
On 11/29/11 8:22 AM, Anne van Kesteren wrote: > document.head.setAttributeNS("test", "x:a", "a") > document.head.setAttributeNS("test", "e:a", "b") > > Should the result be an attribute "x:a" or "e:a"? Gecko says "e:a", > Opera/Webkit say "x:a". Making the prefix member of an attribute > completely immutable seems somewhat preferable to me. Opinions? > > Step 10 of the setAttributeNS() spec currently requires e:a, right? That's how I implemented it in dom.js, and it made my attribute code and data structures more complicated than they would have been otherwise. If I'm not mistaken, it is that one step in this one method that allows an element to have multiple attributes with the same qualified name. So this one method causes the specs for all the other attribute methods to have to say "...the first attribute in the context object's attributes whose name is..." instead of "...the attribute whose name is..." Making the change would simplify the spec and simplify implementations and presumably (given Opera and Webkit) wouldn't have much web compatibility impact, so I'm for it. (Though I wish I hadn't wasted my time getting it right in the first place!) But even if we can't change the spec for setAttributeNS, can we deprecate it and the rest of the *AttributeNS methods and replace them with something simpler as part of the "improving the DOM" effort? For example, we could allow setAttribute() to be called with two arguments (qname, value) or three arguments (ns, lname, value). And similarly for getAttribute, hasAttribute and removeAttribute. David David
Received on Tuesday, 29 November 2011 18:18:04 UTC