[Webkit-unassigned] [Bug 148589] New: DOMTokenList update steps for classList don't follow the spec

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 28 14:14:46 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=148589

            Bug ID: 148589
           Summary: DOMTokenList update steps for classList don't follow
                    the spec
    Classification: Unclassified
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: m.goleb+bugzilla at gmail.com

Steps to reproduce the problem:
```
var div = document.createElement('div');
div.className = '   a   b   c   ';
div.classList.remove('b');

console.log(div.className); // "  a c  "
```


`DOMTokenList` [update steps](https://dom.spec.whatwg.org/#domtokenlist)' second point is:

"Set an attribute value for the associated element using associated attribute’s local name and the result of running the ordered set serializer for tokens."

For `classList` the "associated attribute's local name" is `class`. The ["ordered set serializer" algorithm](https://dom.spec.whatwg.org/#concept-ordered-set-serializer) is:
"The ordered set serializer takes a set and returns the concatenation of the strings in set, separated from each other by U+0020". This means that after updating the context object's classes via the classList API, className value (that reflects the "class" attribute value) should be "a c", not "   a c   ".

Edge is the only browser that returns "a c" correctly for the above test case.


https://code.google.com/p/chromium/issues/detail?id=526282

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150828/e3a9c9ff/attachment-0001.html>


More information about the webkit-unassigned mailing list