- From: Boris Zbarsky <notifications@github.com>
- Date: Wed, 11 Nov 2015 22:29:22 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Message-ID: <whatwg/dom/issues/105@github.com>
It looks like the spec for this got changed in 2012 in <https://github.com/whatwg/dom/commit/8deff0eb9275dadec6fd41cc9eaeec93ee14bb54>, after all browsers had already interoperably implemented the previous spec. Simple testcase:
<div class=" a b c "></div>
<pre id="log"></pre>
<script>
document.querySelector("pre").textContent =
document.querySelector("div").classList;
</script>
Per current spec, the value in the `<pre>` should be:
a b c
but all of Firefox, Chrome, Safari, IE (edge) make it
a b c
(with leading and trailing whitespace). You can see a live testcase at http://jsfiddle.net/e3LwzL9d/
It's probably a good idea to revert to the old behavior, and similarly to have the `DOMSettableTokenList` getter for `value` just get the attribute value, so it stays in sync with the stringification behavior. You can see a testcase for that case at http://jsfiddle.net/e3LwzL9d/1/ and it looks like this:
<iframe sandbox=" a b c "></iframe>
<pre id="log"></pre>
<script>
document.querySelector("pre").textContent =
document.querySelector("iframe").sandbox.value;
</script>
Again, all browsers that implement `DOMSettableTokenList.value` (IE, Chrome, Firefox) return
a b c
here, not
a b c
---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/105
Received on Thursday, 12 November 2015 06:29:55 UTC