<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&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>m.goleb+bugzilla&#64;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); // &quot;  a c  &quot;
```


`DOMTokenList` [update steps](<a href="https://dom.spec.whatwg.org/#domtokenlist">https://dom.spec.whatwg.org/#domtokenlist</a>)' second point is:

&quot;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.&quot;

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

Edge is the only browser that returns &quot;a c&quot; 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>