[dom] DOMTokenList/DOMSettableTokenList and associated attribute or attribute’s local name

ArkadiuszMichalski has just created a new issue for 
https://github.com/whatwg/dom:

== DOMTokenList/DOMSettableTokenList and associated attribute or 
attribute’s local name ==
What exactly DOMTokenList and DOMSettableTokenList have associated? 
Now I see some inaccuracy:

"A DOMTokenList object also has an associated element and an 
attribute’s local name."
"A DOMSettableTokenList object is equivalent to a DOMTokenList object 
without an associated attribute."

And in update steps: 
"1. If there is no associated attribute (when the object is a 
DOMSettableTokenList), terminate these steps."

So DOMTokenList has associated attribute (and we can directly check 
them) or some attribute’s local name, and we must firstly find this 
attribute by using this local name? Update steps invoke "Set an 
attribute value" where we pass local name, so in all above case should
 not be just attribute’s local name?

Btw., maybe write for "ordered set serializer" what should be happen 
when set is empty (just return empty string). This would be clear and 
in the future can help capture various specific cases. I notice one 
different beetwen Firefox (correct per spec) and Chrome:
```
<script>

        var div = document.createElement("div");

        document.write(div.hasAttribute("class")); // false
        document.write("<br>");
        document.write(div.getAttribute("class")); // null
        document.write("<br>");
        document.write(div.className.length); // 0
        document.write("<br>");
        document.write(div.classList.length); // 0

        div.classList.add();
        document.write("<br><br>");

        document.write(div.hasAttribute("class")); // true, in Chrome 
false
        document.write("<br>");
        document.write(div.getAttribute("class")); // "", in Chrome 
null
        document.write("<br>");
        document.write(div.className.length); // 0
        document.write("<br>");
        document.write(div.classList.length); // 0

</script>
```
When invoking add() and remove() methods without any arguments (and 
set of tokens was empty and associated attr was not set) Chrome 
doesn't set this attr (with empty string as value), but Firefox does 
(what is correct per actual spec). If it's intended then Blink team 
should fix it.


See https://github.com/whatwg/dom/issues/91

Received on Saturday, 17 October 2015 11:35:55 UTC