<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - DOMTokenList update steps for classList don't follow the spec"
href="https://bugs.webkit.org/show_bug.cgi?id=148589">148589</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>DOMTokenList update steps for classList don't follow the spec
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>WebKit Nightly Build
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>JavaScriptCore
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>m.goleb+bugzilla@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>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](<a href="https://dom.spec.whatwg.org/#domtokenlist">https://dom.spec.whatwg.org/#domtokenlist</a>)' 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](<a href="https://dom.spec.whatwg.org/#concept-ordered-set-serializer">https://dom.spec.whatwg.org/#concept-ordered-set-serializer</a>) 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.
<a href="https://code.google.com/p/chromium/issues/detail?id=526282">https://code.google.com/p/chromium/issues/detail?id=526282</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>