<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[199296] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/199296">199296</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-04-11 09:50:44 -0700 (Mon, 11 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>DOMTokenList.contains() should not throw
https://bugs.webkit.org/show_bug.cgi?id=156453

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Re-sync dom/nodes/Element-classlist.html with upstream @26308720.

* web-platform-tests/dom/nodes/Element-classlist-expected.txt:
* web-platform-tests/dom/nodes/Element-classlist.html:

Source/WebCore:

DOMTokenList.contains() should not throw if the input token is invalid:
https://github.com/whatwg/dom/commit/6d3076e3cbcba662489b272a718bc6b8c0082a74

We now return false in such cases, instead of throwing, which should be
safe with regards to backward compatibility.

No new tests, already covered by existing tests.

* html/DOMTokenList.cpp:
(WebCore::DOMTokenList::contains):
* html/DOMTokenList.h:
* html/DOMTokenList.idl:

LayoutTests:

Update existing layout tests now that DOMTokenList.contains() no longer
throws when called with an invalid token.

* fast/dom/HTMLElement/class-list-expected.txt:
* fast/dom/HTMLElement/class-list-quirks-expected.txt:
* fast/dom/HTMLElement/script-tests/class-list.js:
(shouldThrowDOMException): Deleted.
* fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt:
* fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js:
(shouldThrowDOMException): Deleted.
* fast/dom/rel-list-expected.txt:
* fast/dom/rel-list.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLElementclasslistexpectedtxt">trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLElementclasslistquirksexpectedtxt">trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLElementscripttestsclasslistjs">trunk/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLOutputElementdomsettabletokenlistexpectedtxt">trunk/LayoutTests/fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLOutputElementscripttestsdomsettabletokenlistjs">trunk/LayoutTests/fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js</a></li>
<li><a href="#trunkLayoutTestsfastdomrellistexpectedtxt">trunk/LayoutTests/fast/dom/rel-list-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomrellisthtml">trunk/LayoutTests/fast/dom/rel-list.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomnodesElementclasslistexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomnodesElementclasslisthtml">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMTokenListcpp">trunk/Source/WebCore/html/DOMTokenList.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMTokenListh">trunk/Source/WebCore/html/DOMTokenList.h</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMTokenListidl">trunk/Source/WebCore/html/DOMTokenList.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/LayoutTests/ChangeLog        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2016-04-11  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        DOMTokenList.contains() should not throw
+        https://bugs.webkit.org/show_bug.cgi?id=156453
+
+        Reviewed by Ryosuke Niwa.
+
+        Update existing layout tests now that DOMTokenList.contains() no longer
+        throws when called with an invalid token.
+
+        * fast/dom/HTMLElement/class-list-expected.txt:
+        * fast/dom/HTMLElement/class-list-quirks-expected.txt:
+        * fast/dom/HTMLElement/script-tests/class-list.js:
+        (shouldThrowDOMException): Deleted.
+        * fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt:
+        * fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js:
+        (shouldThrowDOMException): Deleted.
+        * fast/dom/rel-list-expected.txt:
+        * fast/dom/rel-list.html:
+
</ins><span class="cx"> 2016-04-11  Frederic Wang  &lt;fwang@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Refactor RenderMathMLFraction layout to avoid using flexbox
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLElementclasslistexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/LayoutTests/fast/dom/HTMLElement/class-list-expected.txt        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -40,8 +40,8 @@
</span><span class="cx"> PASS element.className is &quot;x y&quot;
</span><span class="cx"> PASS element.className is &quot;y&quot;
</span><span class="cx"> Test invalid tokens
</span><del>-PASS element.classList.contains('') threw expected DOMException with code 12
-PASS element.classList.contains('x y') threw expected DOMException with code 5
</del><ins>+PASS element.classList.contains('') is false
+PASS element.classList.contains('x y') is false
</ins><span class="cx"> PASS element.classList.add('') threw expected DOMException with code 12
</span><span class="cx"> PASS element.classList.add('x y') threw expected DOMException with code 5
</span><span class="cx"> PASS element.classList.remove('') threw expected DOMException with code 12
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLElementclasslistquirksexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -40,8 +40,8 @@
</span><span class="cx"> PASS element.className is &quot;x y&quot;
</span><span class="cx"> PASS element.className is &quot;y&quot;
</span><span class="cx"> Test invalid tokens
</span><del>-PASS element.classList.contains('') threw expected DOMException with code 12
-PASS element.classList.contains('x y') threw expected DOMException with code 5
</del><ins>+PASS element.classList.contains('') is false
+PASS element.classList.contains('x y') is false
</ins><span class="cx"> PASS element.classList.add('') threw expected DOMException with code 12
</span><span class="cx"> PASS element.classList.add('x y') threw expected DOMException with code 5
</span><span class="cx"> PASS element.classList.remove('') threw expected DOMException with code 12
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLElementscripttestsclasslistjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -149,14 +149,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> createElement('x');
</span><del>-shouldThrowDOMException(function() {
-    element.classList.contains('');
-}, DOMException.SYNTAX_ERR);
</del><ins>+shouldBeFalse(&quot;element.classList.contains('')&quot;);
</ins><span class="cx"> 
</span><span class="cx"> createElement('x y');
</span><del>-shouldThrowDOMException(function() {
-    element.classList.contains('x y');
-}, DOMException.INVALID_CHARACTER_ERR);
</del><ins>+shouldBeFalse(&quot;element.classList.contains('x y')&quot;);
</ins><span class="cx"> 
</span><span class="cx"> createElement('');
</span><span class="cx"> shouldThrowDOMException(function() {
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLOutputElementdomsettabletokenlistexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/LayoutTests/fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -32,8 +32,8 @@
</span><span class="cx"> PASS element.htmlFor.toString() is &quot;x y&quot;
</span><span class="cx"> PASS element.htmlFor.toString() is &quot;y&quot;
</span><span class="cx"> - Test invalid tokens
</span><del>-PASS element.htmlFor.contains('') threw expected DOMException with code 12
-PASS element.htmlFor.contains('x y') threw expected DOMException with code 5
</del><ins>+PASS element.htmlFor.contains('') is false
+PASS element.htmlFor.contains('x y') is false
</ins><span class="cx"> PASS element.htmlFor.add('') threw expected DOMException with code 12
</span><span class="cx"> PASS element.htmlFor.add('x y') threw expected DOMException with code 5
</span><span class="cx"> PASS element.htmlFor.remove('') threw expected DOMException with code 12
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLOutputElementscripttestsdomsettabletokenlistjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/LayoutTests/fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -139,14 +139,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> createElement('x');
</span><del>-shouldThrowDOMException(function() {
-    element.htmlFor.contains('');
-}, DOMException.SYNTAX_ERR);
</del><ins>+shouldBeFalse(&quot;element.htmlFor.contains('')&quot;);
</ins><span class="cx"> 
</span><span class="cx"> createElement('x y');
</span><del>-shouldThrowDOMException(function() {
-    element.htmlFor.contains('x y');
-}, DOMException.INVALID_CHARACTER_ERR);
</del><ins>+shouldBeFalse(&quot;element.htmlFor.contains('x y')&quot;);
</ins><span class="cx"> 
</span><span class="cx"> createElement('');
</span><span class="cx"> shouldThrowDOMException(function() {
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomrellistexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/rel-list-expected.txt (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/rel-list-expected.txt        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/LayoutTests/fast/dom/rel-list-expected.txt        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -61,8 +61,8 @@
</span><span class="cx"> PASS element.rel is &quot;x y&quot;
</span><span class="cx"> PASS element.rel is &quot;y&quot;
</span><span class="cx"> Test invalid tokens
</span><del>-PASS element.relList.contains(&quot;&quot;) threw exception Error: SyntaxError: DOM Exception 12.
-PASS element.relList.contains(&quot;x y&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
</del><ins>+PASS element.relList.contains(&quot;&quot;) is false
+PASS element.relList.contains(&quot;x y&quot;) is false
</ins><span class="cx"> PASS element.relList.add(&quot;&quot;) threw exception Error: SyntaxError: DOM Exception 12.
</span><span class="cx"> PASS element.relList.add(&quot;x y&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
</span><span class="cx"> PASS element.relList.remove(&quot;&quot;) threw exception Error: SyntaxError: DOM Exception 12.
</span><span class="lines">@@ -184,8 +184,8 @@
</span><span class="cx"> PASS element.rel is &quot;x y&quot;
</span><span class="cx"> PASS element.rel is &quot;y&quot;
</span><span class="cx"> Test invalid tokens
</span><del>-PASS element.relList.contains(&quot;&quot;) threw exception Error: SyntaxError: DOM Exception 12.
-PASS element.relList.contains(&quot;x y&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
</del><ins>+PASS element.relList.contains(&quot;&quot;) is false
+PASS element.relList.contains(&quot;x y&quot;) is false
</ins><span class="cx"> PASS element.relList.add(&quot;&quot;) threw exception Error: SyntaxError: DOM Exception 12.
</span><span class="cx"> PASS element.relList.add(&quot;x y&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
</span><span class="cx"> PASS element.relList.remove(&quot;&quot;) threw exception Error: SyntaxError: DOM Exception 12.
</span><span class="lines">@@ -307,8 +307,8 @@
</span><span class="cx"> PASS element.rel is &quot;x y&quot;
</span><span class="cx"> PASS element.rel is &quot;y&quot;
</span><span class="cx"> Test invalid tokens
</span><del>-PASS element.relList.contains(&quot;&quot;) threw exception Error: SyntaxError: DOM Exception 12.
-PASS element.relList.contains(&quot;x y&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
</del><ins>+PASS element.relList.contains(&quot;&quot;) is false
+PASS element.relList.contains(&quot;x y&quot;) is false
</ins><span class="cx"> PASS element.relList.add(&quot;&quot;) threw exception Error: SyntaxError: DOM Exception 12.
</span><span class="cx"> PASS element.relList.add(&quot;x y&quot;) threw exception Error: InvalidCharacterError: DOM Exception 5.
</span><span class="cx"> PASS element.relList.remove(&quot;&quot;) threw exception Error: SyntaxError: DOM Exception 12.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomrellisthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/rel-list.html (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/rel-list.html        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/LayoutTests/fast/dom/rel-list.html        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -143,10 +143,10 @@
</span><span class="cx">     debug('Test invalid tokens');
</span><span class="cx"> 
</span><span class="cx">     createElement('x');
</span><del>-    shouldThrow('element.relList.contains(&quot;&quot;)');
</del><ins>+    shouldBeFalse('element.relList.contains(&quot;&quot;)');
</ins><span class="cx"> 
</span><span class="cx">     createElement('x y');
</span><del>-    shouldThrow('element.relList.contains(&quot;x y&quot;)');
</del><ins>+    shouldBeFalse('element.relList.contains(&quot;x y&quot;)');
</ins><span class="cx"> 
</span><span class="cx">     createElement('');
</span><span class="cx">     shouldThrow('element.relList.add(&quot;&quot;)');
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-04-11  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        DOMTokenList.contains() should not throw
+        https://bugs.webkit.org/show_bug.cgi?id=156453
+
+        Reviewed by Ryosuke Niwa.
+
+        Re-sync dom/nodes/Element-classlist.html with upstream @26308720.
+
+        * web-platform-tests/dom/nodes/Element-classlist-expected.txt:
+        * web-platform-tests/dom/nodes/Element-classlist.html:
+
</ins><span class="cx"> 2016-04-08  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
</span><span class="cx"> 
</span><span class="cx">         Testharness-based tests that time out should be able to produce detailed output
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomnodesElementclasslistexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -14,14 +14,17 @@
</span><span class="cx"> PASS classList[index] must be undefined for negative index 
</span><span class="cx"> PASS className should contain initial markup whitespace 
</span><span class="cx"> FAIL classList should contain initial markup whitespace assert_equals: implicit expected &quot; &quot; but got &quot;&quot;
</span><del>-PASS .contains(empty_string) must throw a SYNTAX_ERR 
</del><ins>+PASS .contains(empty_string) must return false 
</ins><span class="cx"> PASS .add(empty_string) must throw a SYNTAX_ERR 
</span><span class="cx"> PASS .remove(empty_string) must throw a SYNTAX_ERR 
</span><span class="cx"> PASS .toggle(empty_string) must throw a SYNTAX_ERR 
</span><del>-PASS .contains(string_with_spaces) must throw an INVALID_CHARACTER_ERR 
</del><ins>+FAIL .replace with empty_string must throw a SYNTAX_ERR assert_throws: function &quot;function () { elem.classList.replace('', 'foo'); }&quot; threw object &quot;TypeError: elem.classList.replace is not a function. (In ...&quot; that is not a DOMException SYNTAX_ERR: property &quot;code&quot; is equal to undefined, expected 12
+PASS .contains(string_with_spaces) must return false 
</ins><span class="cx"> PASS .add(string_with_spaces) must throw an INVALID_CHARACTER_ERR 
</span><span class="cx"> PASS .remove(string_with_spaces) must throw an INVALID_CHARACTER_ERR 
</span><span class="cx"> PASS .toggle(string_with_spaces) must throw an INVALID_CHARACTER_ERR 
</span><ins>+FAIL .replace with string_with_spaces must throw a INVALID_CHARACTER_ERR assert_throws: function &quot;function () { elem.classList.replace('z', 'a b'); }&quot; threw object &quot;TypeError: elem.classList.replace is not a function. (In ...&quot; that is not a DOMException INVALID_CHARACTER_ERR: property &quot;code&quot; is equal to undefined, expected 5
+FAIL .replace with an already existing token foo.classList.replace is not a function. (In 'foo.classList.replace('token1', 'token3')', 'foo.classList.replace' is undefined)
</ins><span class="cx"> PASS computed style must update when setting .className 
</span><span class="cx"> PASS classList.contains must update when .className is changed 
</span><span class="cx"> PASS classList.contains must be case sensitive 
</span><span class="lines">@@ -51,11 +54,20 @@
</span><span class="cx"> PASS classList.toggle must not break case-sensitive CSS selector matching 
</span><span class="cx"> PASS classList.toggle must be able to remove tokens 
</span><span class="cx"> PASS classList.toggle must be case-sensitive when removing tokens 
</span><ins>+FAIL classList.replace replaces arguments passed, if they are present. secondelem.classList.replace is not a function. (In 'secondelem.classList.replace('bar', 'baz')', 'secondelem.classList.replace' is undefined)
+FAIL classList.replace must replace existing tokens secondelem.classList.replace is not a function. (In 'secondelem.classList.replace('foo', 'bar')', 'secondelem.classList.replace' is undefined)
+FAIL classList.replace must not break case-sensitive CSS selector matching assert_not_equals: got disallowed value &quot;italic&quot;
+FAIL classList.replace must replace duplicated tokens secondelem.classList.replace is not a function. (In 'secondelem.classList.replace('token1', 'token3')', 'secondelem.classList.replace' is undefined)
+FAIL classList.replace must collapse whitespace around replaced tokens secondelem.classList.replace is not a function. (In 'secondelem.classList.replace('token2', 'token4')', 'secondelem.classList.replace' is undefined)
+FAIL classList.replace must collapse whitespaces around each token secondelem.classList.replace is not a function. (In 'secondelem.classList.replace('token2', 'token3')', 'secondelem.classList.replace' is undefined)
+FAIL classList.replace must collapse whitespaces around each token and remove duplicates secondelem.classList.replace is not a function. (In 'secondelem.classList.replace('token2', 'token3')', 'secondelem.classList.replace' is undefined)
+FAIL classList.replace must collapse whitespace when replacing duplicate tokens secondelem.classList.replace is not a function. (In 'secondelem.classList.replace('token1', 'token3')', 'secondelem.classList.replace' is undefined)
</ins><span class="cx"> PASS CSS class selectors must stop matching when all classes have been removed 
</span><span class="cx"> PASS className must be empty when all classes have been removed 
</span><span class="cx"> PASS classList must stringify to an empty string when all classes have been removed 
</span><span class="cx"> PASS classList.item(0) must return null when all classes have been removed 
</span><span class="cx"> PASS classList[0] must be undefined when all classes have been removed 
</span><ins>+PASS Invoking add or remove should set the class attribute 
</ins><span class="cx"> PASS classList.add should treat &quot; &quot; as a space 
</span><span class="cx"> PASS classList.add should treat \t as a space 
</span><span class="cx"> PASS classList.add should treat \r as a space 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomnodesElementclasslisthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist.html (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist.html        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist.html        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -66,8 +66,8 @@
</span><span class="cx">   assert_equals( elem.classList.toString(), ' ', 'explicit' );
</span><span class="cx"> }, 'classList should contain initial markup whitespace');
</span><span class="cx"> test(function () {
</span><del>-  assert_throws( 'SYNTAX_ERR', function () { elem.classList.contains(''); } );
-}, '.contains(empty_string) must throw a SYNTAX_ERR');
</del><ins>+  assert_false( elem.classList.contains('') );
+}, '.contains(empty_string) must return false');
</ins><span class="cx"> test(function () {
</span><span class="cx">   assert_throws( 'SYNTAX_ERR', function () { elem.classList.add(''); } );
</span><span class="cx"> }, '.add(empty_string) must throw a SYNTAX_ERR');
</span><span class="lines">@@ -78,9 +78,16 @@
</span><span class="cx">   assert_throws( 'SYNTAX_ERR', function () { elem.classList.toggle(''); } );
</span><span class="cx"> }, '.toggle(empty_string) must throw a SYNTAX_ERR');
</span><span class="cx"> test(function () {
</span><del>-  assert_throws( 'INVALID_CHARACTER_ERR', function () { elem.classList.contains('a b'); } );
-}, '.contains(string_with_spaces) must throw an INVALID_CHARACTER_ERR');
</del><ins>+  assert_throws( 'SYNTAX_ERR', function () { elem.classList.replace('', 'foo'); } );
+  assert_throws( 'SYNTAX_ERR', function () { elem.classList.replace('foo', ''); } );
+  assert_throws( 'SYNTAX_ERR', function () { elem.classList.replace('', 'foo bar'); } );
+  assert_throws( 'SYNTAX_ERR', function () { elem.classList.replace('foo bar', ''); } );
+  assert_throws( 'SYNTAX_ERR', function () { elem.classList.replace('', ''); } );
+}, '.replace with empty_string must throw a SYNTAX_ERR');
</ins><span class="cx"> test(function () {
</span><ins>+  assert_false( elem.classList.contains('a b') );
+}, '.contains(string_with_spaces) must return false');
+test(function () {
</ins><span class="cx">   assert_throws( 'INVALID_CHARACTER_ERR', function () { elem.classList.add('a b'); } );
</span><span class="cx"> }, '.add(string_with_spaces) must throw an INVALID_CHARACTER_ERR');
</span><span class="cx"> test(function () {
</span><span class="lines">@@ -89,6 +96,20 @@
</span><span class="cx"> test(function () {
</span><span class="cx">   assert_throws( 'INVALID_CHARACTER_ERR', function () { elem.classList.toggle('a b'); } );
</span><span class="cx"> }, '.toggle(string_with_spaces) must throw an INVALID_CHARACTER_ERR');
</span><ins>+test(function () {
+  assert_throws( 'INVALID_CHARACTER_ERR', function () { elem.classList.replace('z', 'a b'); } );
+  assert_throws( 'INVALID_CHARACTER_ERR', function () { elem.classList.replace('a b', 'z'); } );
+  assert_throws( 'INVALID_CHARACTER_ERR', function () { elem.classList.replace('a b', 'b c'); } );
+}, '.replace with string_with_spaces must throw a INVALID_CHARACTER_ERR');
+test(function () {
+  var foo = document.createElement('div');
+  foo.className = 'token1 token2 token3'
+  foo.classList.replace('token1', 'token3');
+  assert_equals( foo.classList.length, 2 );
+  assert_false( foo.classList.contains('token1') );
+  assert_true( foo.classList.contains('token2') );
+  assert_true( foo.classList.contains('token3') );
+}, '.replace with an already existing token')
</ins><span class="cx"> elem.className = 'foo';
</span><span class="cx"> test(function () {
</span><span class="cx">   assert_equals( getComputedStyle(elem,null).fontStyle, 'italic', 'critical test; required by the testsuite' );
</span><span class="lines">@@ -225,6 +246,58 @@
</span><span class="cx">   assert_false( elem.classList.contains('FOO') );
</span><span class="cx"> }, 'classList.toggle must be case-sensitive when removing tokens');
</span><span class="cx"> test(function () {
</span><ins>+  secondelem.className = 'foo FOO'
+  secondelem.classList.replace('bar', 'baz');
+  assert_equals( secondelem.classList.length, 2 );
+  assert_equals( secondelem.classList + '', 'foo FOO', 'implicit' );
+  assert_equals( secondelem.classList.toString(), 'foo FOO', 'explicit' );
+}, 'classList.replace replaces arguments passed, if they are present.');
+test(function () {
+  secondelem.classList.replace('foo', 'bar');
+  assert_equals( secondelem.classList.length, 2 );
+  assert_equals( secondelem.classList + '', 'bar FOO', 'implicit' );
+  assert_equals( secondelem.classList.toString(), 'bar FOO', 'explicit' );
+  assert_false( secondelem.classList.contains('foo') );
+  assert_true( secondelem.classList.contains('bar') );
+  assert_true( secondelem.classList.contains('FOO') );
+}, 'classList.replace must replace existing tokens');
+test(function () {
+  assert_not_equals( getComputedStyle(secondelem,null).fontStyle, 'italic' );
+}, 'classList.replace must not break case-sensitive CSS selector matching');
+test(function () {
+  secondelem.className = 'token1 token2 token1'
+  secondelem.classList.replace('token1', 'token3');
+  assert_equals( secondelem.classList.length, 2 );
+  assert_false( secondelem.classList.contains('token1') );
+  assert_true( secondelem.classList.contains('token2') );
+  assert_true( secondelem.classList.contains('token3') );
+}, 'classList.replace must replace duplicated tokens');
+test(function () {
+  secondelem.className = 'token1  token2  token3';
+  secondelem.classList.replace('token2', 'token4');
+  assert_equals( secondelem.classList + '', 'token1 token4 token3', 'implicit' );
+  assert_equals( secondelem.classList.toString(), 'token1 token4 token3', 'explicit' );
+}, 'classList.replace must collapse whitespace around replaced tokens');
+test(function () {
+  secondelem.className = ' token1 token2  ';
+  secondelem.classList.replace('token2', 'token3');
+  assert_equals( secondelem.classList.length, 2 );
+  assert_equals( secondelem.classList + '', 'token1 token3', 'implicit' );
+  assert_equals( secondelem.classList.toString(), 'token1 token3', 'explicit' );
+}, 'classList.replace must collapse whitespaces around each token');
+test(function () {
+  secondelem.className = '  token1  token2  token1  ';
+  secondelem.classList.replace('token2', 'token3');
+  assert_equals( secondelem.classList + '', 'token1 token3', 'implicit' );
+  assert_equals( secondelem.classList.toString(), 'token1 token3', 'explicit' );
+}, 'classList.replace must collapse whitespaces around each token and remove duplicates');
+test(function () {
+  secondelem.className = '  token1  token2  token1  ';
+  secondelem.classList.replace('token1', 'token3');
+  assert_equals( secondelem.classList + '', 'token3 token2', 'implicit' );
+  assert_equals( secondelem.classList.toString(), 'token3 token2', 'explicit' );
+}, 'classList.replace must collapse whitespace when replacing duplicate tokens');
+test(function () {
</ins><span class="cx">   assert_not_equals( getComputedStyle(elem,null).fontStyle, 'italic' );
</span><span class="cx"> }, 'CSS class selectors must stop matching when all classes have been removed');
</span><span class="cx"> test(function () {
</span><span class="lines">@@ -245,6 +318,13 @@
</span><span class="cx">   WebIDL creates actual OwnProperties and then [] just acts as a normal property lookup */
</span><span class="cx">   assert_equals( elem.classList[0], undefined );
</span><span class="cx"> }, 'classList[0] must be undefined when all classes have been removed');
</span><ins>+test(function () {
+  var foo = document.createElement('div');
+  foo.classList.add();
+  assert_true( foo.hasAttribute('class') );
+  assert_equals( foo.classList + '', '', 'implicit' );
+  assert_equals( foo.classList.toString(), '', 'explicit' );
+}, 'Invoking add or remove should set the class attribute');
</ins><span class="cx"> // The ordered set parser must skip ASCII whitespace (U+0009, U+000A, U+000C, U+000D, and U+0020.)
</span><span class="cx"> test(function () {
</span><span class="cx">   var foo = document.createElement('div');
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/Source/WebCore/ChangeLog        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2016-04-11  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        DOMTokenList.contains() should not throw
+        https://bugs.webkit.org/show_bug.cgi?id=156453
+
+        Reviewed by Ryosuke Niwa.
+
+        DOMTokenList.contains() should not throw if the input token is invalid:
+        https://github.com/whatwg/dom/commit/6d3076e3cbcba662489b272a718bc6b8c0082a74
+
+        We now return false in such cases, instead of throwing, which should be
+        safe with regards to backward compatibility.
+
+        No new tests, already covered by existing tests.
+
+        * html/DOMTokenList.cpp:
+        (WebCore::DOMTokenList::contains):
+        * html/DOMTokenList.h:
+        * html/DOMTokenList.idl:
+
</ins><span class="cx"> 2016-04-11  Frederic Wang  &lt;fwang@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Refactor RenderMathMLFraction layout to avoid using flexbox
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMTokenListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMTokenList.cpp (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMTokenList.cpp        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/Source/WebCore/html/DOMTokenList.cpp        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -62,11 +62,8 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool DOMTokenList::contains(const AtomicString&amp; token, ExceptionCode&amp; ec) const
</del><ins>+bool DOMTokenList::contains(const AtomicString&amp; token) const
</ins><span class="cx"> {
</span><del>-    if (!validateToken(token, ec))
-        return false;
-
</del><span class="cx">     return m_tokens.contains(token);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMTokenListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMTokenList.h (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMTokenList.h        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/Source/WebCore/html/DOMTokenList.h        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx">     unsigned length() const;
</span><span class="cx">     const AtomicString&amp; item(unsigned index) const;
</span><span class="cx"> 
</span><del>-    bool contains(const AtomicString&amp;, ExceptionCode&amp;) const;
</del><ins>+    bool contains(const AtomicString&amp;) const;
</ins><span class="cx">     void add(const Vector&lt;String&gt;&amp;, ExceptionCode&amp;);
</span><span class="cx">     void add(const AtomicString&amp;, ExceptionCode&amp;);
</span><span class="cx">     void remove(const Vector&lt;String&gt;&amp;, ExceptionCode&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMTokenListidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMTokenList.idl (199295 => 199296)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMTokenList.idl        2016-04-11 15:38:46 UTC (rev 199295)
+++ trunk/Source/WebCore/html/DOMTokenList.idl        2016-04-11 16:50:44 UTC (rev 199296)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> ] interface DOMTokenList {
</span><span class="cx">     readonly attribute unsigned long length;
</span><span class="cx">     getter DOMString? item(unsigned long index);
</span><del>-    [RaisesException] boolean contains(DOMString token);
</del><ins>+    boolean contains(DOMString token);
</ins><span class="cx">     [RaisesException] void add(DOMString... tokens);
</span><span class="cx">     [RaisesException] void remove(DOMString... tokens);
</span><span class="cx">     [RaisesException, Custom] boolean toggle(DOMString token, optional boolean force);
</span></span></pre>
</div>
</div>

</body>
</html>