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

None via GitHub <[email protected]> Sat, 17 Oct 2015 11:35:53 +0000
Newsgroups gmane.comp.web.dom.general
Message-ID <[email protected]>
ArkadiuszMichalski has just created a new issue for =

https://github.com/whatwg/dom:

=3D=3D DOMTokenList/DOMSettableTokenList and associated attribute or =

attribute=E2=80=99s local name =3D=3D
What exactly DOMTokenList and DOMSettableTokenList have associated? =

Now I see some inaccuracy:

"A DOMTokenList object also has an associated element and an =

attribute=E2=80=99s 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=E2=80=99s 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=E2=80=99s 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 =3D 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