<!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>[195248] 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/195248">195248</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-18 23:37:32 -0800 (Mon, 18 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>createAttribute should lowercase the attribute name in a HTML document
https://bugs.webkit.org/show_bug.cgi?id=153112

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline a test now that it's passing all test cases.

* web-platform-tests/dom/nodes/Document-createAttribute-expected.txt:

Source/WebCore:

In a HTML document, we should always lowercase localName in document.createAttribute as specified in
https://dom.spec.whatwg.org/#dom-document-createattribute:

1. If localName does not match the Name production in XML, throw an InvalidCharacterError exception.
2. If the context object is an HTML document, let localName be converted to ASCII lowercase.
3. Return a new attribute whose local name is localName.

Change WebKit's behavior to match the spec as well as Firefox. document.createAttributeNS will
continue to preserve the case as spec'ed.

No new tests are added since the behavior change is covered by existing tests.

* dom/Document.cpp:
(WebCore::Document::createAttribute):

LayoutTests:

Update tests, rebaseline tests, and add more test cases as needed.

createAttribute lowercases localName and getAttributeNode finds attribute ignoring cases
whereas createAttributeNS preserves localName's case and getAttributeNodeNS finds attribute preserving cases

* fast/dom/Element/mozilla-dom-base-tests/test_bug1075702-expected.txt: Since the test is adding &quot;aa&quot; as well
as &quot;AA&quot; as Attr nodes, we should be able to get both.
* fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.xhtml: Renamed from .html file since test cases here
are more relevant for XHTML documents.

* fast/dom/Element/getAttribute-check-case-sensitivity-expected.txt:
* fast/dom/Element/script-tests/getAttribute-check-case-sensitivity.js:
(testGetAttributeNodeMixedCase): Change the test case to retrieve the attribute name with lowercase name
since createAttribute always lowercases the name in a HTML document.
(testAttribNodeNamePreservesCase): Use getAttributeNode instead of getAttributeNodeNS since the former does
case insensitive lookup as needed here.
(testAttribNodeNamePreservesCaseGetNode): Ditto.
(testAttribNodeNamePreservesCaseGetNode2): Ditto. Use createAttributeNS to create a case-preserving Attr node.

* fast/dom/Element/setAttributeNode-case-insensitivity-expected.txt:
* fast/dom/Element/setAttributeNode-case-insensitivity.html: Since getAttributeNode does a case-insensitive
lookup, we should be getting the same Attr node for both 'style' and 'STYLE'.

* fast/dom/Element/setAttributeNode-for-existing-attribute-expected.txt: Rebaselined. This is a progression
since we're now getting &quot;green&quot; when querying style.backgroundColor as expected.

* fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-expected.txt:
* fast/dom/Element/setAttributeNode-overriding-lowercase-values-1.html: Updated test cases for new behavior.

* fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml-expected.txt: Added.
* fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml.xhtml: Added. Test behaviors in a XML
document.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomElementgetAttributecheckcasesensitivityexpectedtxt">trunk/LayoutTests/fast/dom/Element/getAttribute-check-case-sensitivity-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomElementmozilladombaseteststest_bug1075702expectedtxt">trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomElementscripttestsgetAttributecheckcasesensitivityjs">trunk/LayoutTests/fast/dom/Element/script-tests/getAttribute-check-case-sensitivity.js</a></li>
<li><a href="#trunkLayoutTestsfastdomElementsetAttributeNodecaseinsensitivityexpectedtxt">trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomElementsetAttributeNodecaseinsensitivityhtml">trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html</a></li>
<li><a href="#trunkLayoutTestsfastdomElementsetAttributeNodeforexistingattributeexpectedtxt">trunk/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomElementsetAttributeNodeoverridinglowercasevalues1expectedtxt">trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomElementsetAttributeNodeoverridinglowercasevalues1html">trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomnodesDocumentcreateAttributeexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createAttribute-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomElementmozilladombaseteststest_bug1075702xhtml">trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.xhtml</a></li>
<li><a href="#trunkLayoutTestsfastdomElementsetAttributeNodeoverridinglowercasevalues1xmlexpectedtxt">trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomElementsetAttributeNodeoverridinglowercasevalues1xmlxhtml">trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml.xhtml</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomElementmozilladombaseteststest_bug1075702html">trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/ChangeLog        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2016-01-18  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        createAttribute should lowercase the attribute name in a HTML document
+        https://bugs.webkit.org/show_bug.cgi?id=153112
+
+        Reviewed by Darin Adler.
+
+        Update tests, rebaseline tests, and add more test cases as needed.
+
+        createAttribute lowercases localName and getAttributeNode finds attribute ignoring cases
+        whereas createAttributeNS preserves localName's case and getAttributeNodeNS finds attribute preserving cases
+
+        * fast/dom/Element/mozilla-dom-base-tests/test_bug1075702-expected.txt: Since the test is adding &quot;aa&quot; as well
+        as &quot;AA&quot; as Attr nodes, we should be able to get both.
+        * fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.xhtml: Renamed from .html file since test cases here
+        are more relevant for XHTML documents.
+
+        * fast/dom/Element/getAttribute-check-case-sensitivity-expected.txt:
+        * fast/dom/Element/script-tests/getAttribute-check-case-sensitivity.js:
+        (testGetAttributeNodeMixedCase): Change the test case to retrieve the attribute name with lowercase name
+        since createAttribute always lowercases the name in a HTML document.
+        (testAttribNodeNamePreservesCase): Use getAttributeNode instead of getAttributeNodeNS since the former does
+        case insensitive lookup as needed here.
+        (testAttribNodeNamePreservesCaseGetNode): Ditto.
+        (testAttribNodeNamePreservesCaseGetNode2): Ditto. Use createAttributeNS to create a case-preserving Attr node.
+
+        * fast/dom/Element/setAttributeNode-case-insensitivity-expected.txt:
+        * fast/dom/Element/setAttributeNode-case-insensitivity.html: Since getAttributeNode does a case-insensitive
+        lookup, we should be getting the same Attr node for both 'style' and 'STYLE'.
+
+        * fast/dom/Element/setAttributeNode-for-existing-attribute-expected.txt: Rebaselined. This is a progression
+        since we're now getting &quot;green&quot; when querying style.backgroundColor as expected.
+
+        * fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-expected.txt:
+        * fast/dom/Element/setAttributeNode-overriding-lowercase-values-1.html: Updated test cases for new behavior.
+
+        * fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml-expected.txt: Added.
+        * fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml.xhtml: Added. Test behaviors in a XML
+        document.
+
</ins><span class="cx"> 2016-01-18  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Modern IDB: Add private-browsing variant for many IDB tests, and enable private browsing in Modern IDB.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomElementgetAttributecheckcasesensitivityexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Element/getAttribute-check-case-sensitivity-expected.txt (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/getAttribute-check-case-sensitivity-expected.txt        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/fast/dom/Element/getAttribute-check-case-sensitivity-expected.txt        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -9,14 +9,17 @@
</span><span class="cx"> PASS testGetAttributeNodeMixedCase() is &quot;x&quot;
</span><span class="cx"> PASS testGetAttributeNodeLowerCase() is &quot;x&quot;
</span><span class="cx"> PASS testSetAttributeNodeKeepsRef() is &quot;1&quot;
</span><del>-PASS testAttribNodeNamePreservesCase() is &quot;A,A&quot;
-PASS testAttribNodeNamePreservesCaseGetNode() is &quot;A,A&quot;
</del><ins>+PASS testAttribNodeNamePreservesCase() is &quot;a,a&quot;
+PASS testAttribNodeNamePreservesCaseGetNode() is &quot;a,a&quot;
</ins><span class="cx"> PASS testAttribNodeNamePreservesCaseGetNode2() is &quot;B,B&quot;
</span><span class="cx"> PASS testAttribNodeNameGetMutate() is &quot;1&quot;
</span><del>-PASS (new XMLSerializer).serializeToString(node) is &quot;&lt;div xmlns=\&quot;http://www.w3.org/1999/xhtml\&quot; myAttrib=\&quot;XXX\&quot;&gt;&lt;/div&gt;&quot;
-PASS node.getAttributeNodeNS('', 'myAttrib').name is &quot;myAttrib&quot;
-PASS node.getAttributeNodeNS('', 'myattrib') is null
-PASS attrib.name is &quot;myAttrib&quot;
</del><ins>+PASS (new XMLSerializer).serializeToString(node) is &quot;&lt;div xmlns=\&quot;http://www.w3.org/1999/xhtml\&quot; myattrib=\&quot;XXX\&quot; myAttrib2=\&quot;XXX\&quot;&gt;&lt;/div&gt;&quot;
+PASS node.getAttributeNodeNS('', 'myattrib') is attrib
+PASS node.getAttributeNodeNS('', 'myAttrib') is null
+PASS attrib.name is &quot;myattrib&quot;
+PASS node.getAttributeNodeNS('', 'myAttrib2') is attrib2
+PASS node.getAttributeNodeNS('', 'myattrib2') is null
+PASS attrib2.name is &quot;myAttrib2&quot;
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomElementmozilladombaseteststest_bug1075702expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702-expected.txt (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702-expected.txt        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702-expected.txt        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -3,8 +3,8 @@
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;aa&quot;) is false
-PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;aa&quot;) is null
</del><ins>+PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;aa&quot;) is true
+PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;aa&quot;) is &quot;lowercase&quot;
</ins><span class="cx"> PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;AA&quot;) is true
</span><span class="cx"> PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;AA&quot;) is &quot;UPPERCASE&quot;
</span><span class="cx"> PASS successfullyParsed is true
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomElementmozilladombaseteststest_bug1075702html"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.html (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.html        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.html        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -1,39 +0,0 @@
</span><del>-&lt;!DOCTYPE HTML&gt;
-&lt;html&gt;
-&lt;!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1075702
---&gt;
-&lt;head&gt;
-    &lt;meta charset=&quot;utf-8&quot;&gt;
-    &lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-&lt;/head&gt;
-&lt;body&gt;
-&lt;a target=&quot;_blank&quot; href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1075702&quot;&gt; Mozilla Bug 1075702 &lt;/a&gt;
-&lt;p id=&quot;display&quot;&gt;&lt;/p&gt;
-
-&lt;pre id=&quot;test&quot;&gt;&lt;/pre&gt;
-&lt;script type=&quot;application/javascript&quot;&gt;
-
-  /** Test for Bug 1075702 **/
-  // test: Element.removeAttributeNode()
-  description(&quot;Test adapted from Mozilla Bug 1075702&quot;);
-
-  var a1 = document.createAttribute(&quot;aa&quot;);
-  a1.nodeValue = &quot;lowercase&quot;;
-
-  var a2 = document.createAttribute(&quot;AA&quot;);
-  a2.nodeValue = &quot;UPPERCASE&quot;;
-
-  document.documentElement.setAttributeNode(a1);
-
-  document.documentElement.setAttributeNode(a2);
-
-  shouldBeFalse('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;aa&quot;)');
-  shouldBeNull('document.documentElement.getAttributeNS(&quot;&quot;, &quot;aa&quot;)');
-  shouldBeTrue('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;AA&quot;)');
-  shouldBeEqualToString('document.documentElement.getAttributeNS(&quot;&quot;, &quot;AA&quot;)', 'UPPERCASE');
-
-&lt;/script&gt;
-&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomElementmozilladombaseteststest_bug1075702xhtmlfromrev195247trunkLayoutTestsfastdomElementmozilladombaseteststest_bug1075702html"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.xhtml (from rev 195247, trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.html) (0 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.xhtml                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.xhtml        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html xml:lang=&quot;en&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
+&lt;!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1075702
+--&gt;
+&lt;head&gt;
+    &lt;meta charset=&quot;utf-8&quot;/&gt;
+    &lt;script src=&quot;../../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;a target=&quot;_blank&quot; href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1075702&quot;&gt; Mozilla Bug 1075702 &lt;/a&gt;
+&lt;p id=&quot;display&quot;&gt;&lt;/p&gt;
+
+&lt;pre id=&quot;test&quot;&gt;&lt;/pre&gt;
+&lt;script type=&quot;application/javascript&quot;&gt;
+
+  /** Test for Bug 1075702 **/
+  // test: Element.removeAttributeNode()
+  description(&quot;Test adapted from Mozilla Bug 1075702&quot;);
+
+  var a1 = document.createAttribute(&quot;aa&quot;);
+  a1.nodeValue = &quot;lowercase&quot;;
+
+  var a2 = document.createAttribute(&quot;AA&quot;);
+  a2.nodeValue = &quot;UPPERCASE&quot;;
+
+  document.documentElement.setAttributeNode(a1);
+
+  document.documentElement.setAttributeNode(a2);
+
+  shouldBeTrue('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;aa&quot;)');
+  shouldBeEqualToString('document.documentElement.getAttributeNS(&quot;&quot;, &quot;aa&quot;)', 'lowercase');
+  shouldBeTrue('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;AA&quot;)');
+  shouldBeEqualToString('document.documentElement.getAttributeNS(&quot;&quot;, &quot;AA&quot;)', 'UPPERCASE');
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomElementscripttestsgetAttributecheckcasesensitivityjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Element/script-tests/getAttribute-check-case-sensitivity.js (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/script-tests/getAttribute-check-case-sensitivity.js        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/fast/dom/Element/script-tests/getAttribute-check-case-sensitivity.js        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -19,7 +19,7 @@
</span><span class="cx">     var a = div.ownerDocument.createAttribute(&quot;mixedCaseAttrib&quot;);
</span><span class="cx">     a.nodeValue = &quot;x&quot;;
</span><span class="cx">     div.setAttributeNode(a);
</span><del>-    return div.getAttributeNS(&quot;&quot;, &quot;mixedCaseAttrib&quot;);
</del><ins>+    return div.getAttributeNS(&quot;&quot;, &quot;mixedcaseattrib&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> shouldBe(&quot;testGetAttributeNodeMixedCase()&quot;, '&quot;x&quot;');
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx">     return result.join(&quot;,&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-shouldBe(&quot;testAttribNodeNamePreservesCase()&quot;, '&quot;A,A&quot;');
</del><ins>+shouldBe(&quot;testAttribNodeNamePreservesCase()&quot;, '&quot;a,a&quot;');
</ins><span class="cx"> 
</span><span class="cx">     
</span><span class="cx"> function testAttribNodeNamePreservesCaseGetNode()
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> 
</span><span class="cx">     body.setAttributeNode(a);
</span><span class="cx"> 
</span><del>-    a = document.body.getAttributeNodeNS(&quot;&quot;, &quot;A&quot;);
</del><ins>+    a = document.body.getAttributeNode(&quot;A&quot;);
</ins><span class="cx">     if (!a)
</span><span class="cx">         return &quot;FAIL&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx">     return result.join(&quot;,&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-shouldBe(&quot;testAttribNodeNamePreservesCaseGetNode()&quot;, '&quot;A,A&quot;');
</del><ins>+shouldBe(&quot;testAttribNodeNamePreservesCaseGetNode()&quot;, '&quot;a,a&quot;');
</ins><span class="cx"> 
</span><span class="cx"> function testAttribNodeNamePreservesCaseGetNode2()
</span><span class="cx"> {
</span><span class="lines">@@ -94,12 +94,11 @@
</span><span class="cx"> 
</span><span class="cx">     body.setAttributeNode(a);
</span><span class="cx"> 
</span><del>-    a = document.body.getAttributeNodeNS(&quot;&quot;, &quot;B&quot;);
</del><ins>+    a = document.body.getAttributeNodeNS(&quot;&quot;, &quot;b&quot;);
</ins><span class="cx">     if (!a)
</span><span class="cx">         return &quot;FAIL&quot;;
</span><span class="cx"> 
</span><del>-    // Now create node second time -- this time case is preserved in FF!
-    a = body.ownerDocument.createAttribute(&quot;B&quot;);
</del><ins>+    a = body.ownerDocument.createAttributeNS(&quot;&quot;, &quot;B&quot;);
</ins><span class="cx">     a.nodeValue = &quot;x&quot;;
</span><span class="cx">     body.setAttributeNode(a);
</span><span class="cx"> 
</span><span class="lines">@@ -135,7 +134,15 @@
</span><span class="cx"> attrib.nodeValue = &quot;XXX&quot;;
</span><span class="cx"> node.setAttributeNode(attrib);
</span><span class="cx"> 
</span><del>-shouldBe(&quot;(new XMLSerializer).serializeToString(node)&quot;, '&quot;&lt;div xmlns=\\&quot;http://www.w3.org/1999/xhtml\\&quot; myAttrib=\\&quot;XXX\\&quot;&gt;&lt;/div&gt;&quot;');
-shouldBe(&quot;node.getAttributeNodeNS('', 'myAttrib').name&quot;, '&quot;myAttrib&quot;');
-shouldBe(&quot;node.getAttributeNodeNS('', 'myattrib')&quot;, 'null');
-shouldBe(&quot;attrib.name&quot;, '&quot;myAttrib&quot;');
</del><ins>+var attrib2 = document.createAttributeNS(&quot;&quot;, &quot;myAttrib2&quot;);
+attrib2.nodeValue = &quot;XXX&quot;;
+node.setAttributeNode(attrib2);
+
+shouldBe(&quot;(new XMLSerializer).serializeToString(node)&quot;, '&quot;&lt;div xmlns=\\&quot;http://www.w3.org/1999/xhtml\\&quot; myattrib=\\&quot;XXX\\&quot; myAttrib2=\\&quot;XXX\\&quot;&gt;&lt;/div&gt;&quot;');
+shouldBe(&quot;node.getAttributeNodeNS('', 'myattrib')&quot;, 'attrib');
+shouldBeNull(&quot;node.getAttributeNodeNS('', 'myAttrib')&quot;);
+shouldBe(&quot;attrib.name&quot;, '&quot;myattrib&quot;');
+
+shouldBe(&quot;node.getAttributeNodeNS('', 'myAttrib2')&quot;, 'attrib2');
+shouldBeNull(&quot;node.getAttributeNodeNS('', 'myattrib2')&quot;);
+shouldBe(&quot;attrib2.name&quot;, '&quot;myAttrib2&quot;');
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomElementsetAttributeNodecaseinsensitivityexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity-expected.txt (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity-expected.txt        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity-expected.txt        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> PASS test.getAttribute('style') is test.getAttribute('STYLE')
</span><del>-PASS test.getAttributeNode('style') is null
</del><ins>+PASS test.getAttributeNode('style') is test.getAttributeNode('STYLE')
</ins><span class="cx"> Verifying that attributes with the same name but different namespaces are treated as unique entities. For the following test two different attribute values should be returned.
</span><span class="cx"> PASS test.getAttributeNodeNS('ns1', 'newattr').value is 'newattr1'
</span><span class="cx"> PASS test.getAttributeNodeNS('ns2', 'newattr').value is 'newattr2'
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomElementsetAttributeNodecaseinsensitivityhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx">         newStyleAttr.value = &quot;background-color: green&quot;;
</span><span class="cx">         test.setAttributeNode(newStyleAttr);
</span><span class="cx">         shouldBe(&quot;test.getAttribute('style')&quot;, &quot;test.getAttribute('STYLE')&quot;);
</span><del>-        shouldBe(&quot;test.getAttributeNode('style')&quot;, &quot;null&quot;);
</del><ins>+        shouldBe(&quot;test.getAttributeNode('style')&quot;, &quot;test.getAttributeNode('STYLE')&quot;);
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">         debug(&quot;Verifying that attributes with the same name but different namespaces are treated as unique entities. For the following test two different attribute values should be returned.&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomElementsetAttributeNodeforexistingattributeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-expected.txt (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-expected.txt        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-expected.txt        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -2,4 +2,4 @@
</span><span class="cx"> 
</span><span class="cx"> Testcase for bug 120293: setAttributeNode() does not set the new value to an existing attribute if specified attribute is in a different case.\nThe issue can be manually verified by ascertaining that a green colored block is displayed instead of a red one.
</span><span class="cx">  
</span><del>-background-color specified with lowercase style attribute was: red and specified with uppercase style attribute is:
</del><ins>+background-color specified with lowercase style attribute was: red and specified with uppercase style attribute is: green
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomElementsetAttributeNodeoverridinglowercasevalues1expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-expected.txt (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-expected.txt        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-expected.txt        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -13,23 +13,23 @@
</span><span class="cx"> PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is false
</span><span class="cx"> PASS document.documentElement.attributes.length is 1
</span><span class="cx"> PASS camelCaseFoobar is not oldAttributeNode
</span><del>-PASS document.documentElement.getAttribute(&quot;foobar&quot;) is null
-PASS document.documentElement.hasAttribute(&quot;foobar&quot;) is false
-PASS document.documentElement.getAttribute(&quot;FooBar&quot;) is null
-PASS document.documentElement.hasAttribute(&quot;FooBar&quot;) is false
-PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;) is null
-PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;) is false
-PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is &quot;Rocks!&quot;
-PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is true
-PASS oldAttributeNode2 is null
</del><ins>+PASS document.documentElement.getAttribute(&quot;foobar&quot;) is &quot;Rocks!&quot;
+PASS document.documentElement.hasAttribute(&quot;foobar&quot;) is true
+PASS document.documentElement.getAttribute(&quot;FooBar&quot;) is &quot;Rocks!&quot;
+PASS document.documentElement.hasAttribute(&quot;FooBar&quot;) is true
+PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;) is &quot;Rocks!&quot;
+PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;) is true
+PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is null
+PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is false
+PASS oldAttributeNode2 is camelCaseFoobar
</ins><span class="cx"> PASS document.documentElement.getAttribute(&quot;foobar&quot;) is &quot;WebKit2&quot;
</span><span class="cx"> PASS document.documentElement.hasAttribute(&quot;foobar&quot;) is true
</span><span class="cx"> PASS document.documentElement.getAttribute(&quot;FooBar&quot;) is &quot;WebKit2&quot;
</span><span class="cx"> PASS document.documentElement.hasAttribute(&quot;FooBar&quot;) is true
</span><span class="cx"> PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;) is &quot;WebKit2&quot;
</span><span class="cx"> PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;) is true
</span><del>-PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is &quot;Rocks!&quot;
-PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is true
</del><ins>+PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is null
+PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is false
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomElementsetAttributeNodeoverridinglowercasevalues1xmlexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml-expected.txt (0 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml-expected.txt        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+Test using setAttributeNode() behaves like setAttribute() to get the existing attribute, but like setAttributeNS() to set the new value.&quot;
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS document.documentElement.getAttribute(&quot;foobar&quot;) is null
+PASS document.documentElement.hasAttribute(&quot;foobar&quot;) is false
+PASS document.documentElement.getAttribute(&quot;FooBar&quot;) is &quot;WebKit&quot;
+PASS document.documentElement.hasAttribute(&quot;FooBar&quot;) is true
+PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;) is null
+PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;) is false
+PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is &quot;WebKit&quot;
+PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is true
+PASS document.documentElement.attributes.length is 3
+PASS camelCaseFoobar is not oldAttributeNode
+PASS document.documentElement.getAttribute(&quot;foobar&quot;) is null
+PASS document.documentElement.hasAttribute(&quot;foobar&quot;) is false
+PASS document.documentElement.getAttribute(&quot;FooBar&quot;) is &quot;Rocks!&quot;
+PASS document.documentElement.hasAttribute(&quot;FooBar&quot;) is true
+PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;) is null
+PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;) is false
+PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is &quot;Rocks!&quot;
+PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is true
+PASS oldAttributeNode2 is null
+PASS document.documentElement.getAttribute(&quot;foobar&quot;) is &quot;WebKit2&quot;
+PASS document.documentElement.hasAttribute(&quot;foobar&quot;) is true
+PASS document.documentElement.getAttribute(&quot;FooBar&quot;) is &quot;Rocks!&quot;
+PASS document.documentElement.hasAttribute(&quot;FooBar&quot;) is true
+PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;) is &quot;WebKit2&quot;
+PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;) is true
+PASS document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is &quot;Rocks!&quot;
+PASS document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomElementsetAttributeNodeoverridinglowercasevalues1xmlxhtmlfromrev195247trunkLayoutTestsfastdomElementsetAttributeNodeoverridinglowercasevalues1html"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml.xhtml (from rev 195247, trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1.html) (0 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml.xhtml                                (rev 0)
+++ trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml.xhtml        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html xml:lang=&quot;en&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;/&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div id=&quot;test-container&quot; style=&quot;display: none;&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;script&gt;
+description('Test using setAttributeNode() behaves like setAttribute() to get the existing attribute, but like setAttributeNS() to set the new value.&quot;');
+
+document.documentElement.setAttribute('FooBar', 'WebKit');
+
+shouldBeNull('document.documentElement.getAttribute(&quot;foobar&quot;)');
+shouldBeFalse('document.documentElement.hasAttribute(&quot;foobar&quot;)');
+shouldBeEqualToString('document.documentElement.getAttribute(&quot;FooBar&quot;)', 'WebKit');
+shouldBeTrue('document.documentElement.hasAttribute(&quot;FooBar&quot;)');
+
+shouldBeNull('document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;)', 'WebKit');
+shouldBeFalse('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;)');
+shouldBeEqualToString('document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;)', 'WebKit');
+shouldBeTrue('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;)');
+
+
+shouldBe('document.documentElement.attributes.length', '3');
+
+// Should replace the value of &quot;FooBar&quot; by &quot;WebKit&quot;.
+var camelCaseFoobar = document.createAttribute(&quot;FooBar&quot;);
+camelCaseFoobar.value = 'Rocks!'
+var oldAttributeNode = document.documentElement.setAttributeNode(camelCaseFoobar);
+
+shouldNotBe('camelCaseFoobar', 'oldAttributeNode');
+
+shouldBe('document.documentElement.getAttribute(&quot;foobar&quot;)', 'null');
+shouldBeFalse('document.documentElement.hasAttribute(&quot;foobar&quot;)');
+shouldBeEqualToString('document.documentElement.getAttribute(&quot;FooBar&quot;)', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttribute(&quot;FooBar&quot;)');
+
+shouldBe('document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;)', 'null');
+shouldBeFalse('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;)');
+shouldBeEqualToString('document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;)', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;)');
+
+// &quot;foobar&quot; should exist alongside &quot;FooBar&quot;.
+var lowerCaseFoobar = document.createAttribute(&quot;foobar&quot;);
+lowerCaseFoobar.value = 'WebKit2'
+var oldAttributeNode2 = document.documentElement.setAttributeNode(lowerCaseFoobar);
+
+shouldBe('oldAttributeNode2', 'null');
+
+shouldBeEqualToString('document.documentElement.getAttribute(&quot;foobar&quot;)', 'WebKit2');
+shouldBeTrue('document.documentElement.hasAttribute(&quot;foobar&quot;)');
+shouldBeEqualToString('document.documentElement.getAttribute(&quot;FooBar&quot;)', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttribute(&quot;FooBar&quot;)');
+
+shouldBeEqualToString('document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;)', 'WebKit2');
+shouldBeTrue('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;)');
+shouldBeEqualToString('document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;)', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;)');
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomElementsetAttributeNodeoverridinglowercasevalues1html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1.html (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1.html        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1.html        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -25,29 +25,29 @@
</span><span class="cx"> 
</span><span class="cx"> shouldBe('document.documentElement.attributes.length', '1');
</span><span class="cx"> 
</span><del>-// &quot;FooBar&quot; should nuke the &quot;foobar&quot; value while itself having the &quot;FooBar&quot; name.
</del><ins>+// &quot;FooBar&quot; should nuke the &quot;foobar&quot; value and itself having the &quot;foobar&quot; name.
</ins><span class="cx"> var camelCaseFoobar = document.createAttribute(&quot;FooBar&quot;);
</span><span class="cx"> camelCaseFoobar.value = 'Rocks!'
</span><span class="cx"> var oldAttributeNode = document.documentElement.setAttributeNode(camelCaseFoobar);
</span><span class="cx"> 
</span><span class="cx"> shouldNotBe('camelCaseFoobar', 'oldAttributeNode');
</span><span class="cx"> 
</span><del>-shouldBe('document.documentElement.getAttribute(&quot;foobar&quot;)', 'null');
-shouldBeFalse('document.documentElement.hasAttribute(&quot;foobar&quot;)');
-shouldBe('document.documentElement.getAttribute(&quot;FooBar&quot;)', 'null');
-shouldBeFalse('document.documentElement.hasAttribute(&quot;FooBar&quot;)');
</del><ins>+shouldBeEqualToString('document.documentElement.getAttribute(&quot;foobar&quot;)', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttribute(&quot;foobar&quot;)');
+shouldBeEqualToString('document.documentElement.getAttribute(&quot;FooBar&quot;)', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttribute(&quot;FooBar&quot;)');
</ins><span class="cx"> 
</span><del>-shouldBe('document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;)', 'null');
-shouldBeFalse('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;)');
-shouldBeEqualToString('document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;)', 'Rocks!');
-shouldBeTrue('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;)');
</del><ins>+shouldBeEqualToString('document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;)', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;)');
+shouldBeNull('document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;)');
+shouldBeFalse('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;)');
</ins><span class="cx"> 
</span><span class="cx"> // &quot;foobar&quot; should exist alongside &quot;FooBar&quot;.
</span><span class="cx"> var lowerCaseFoobar = document.createAttribute(&quot;foobar&quot;);
</span><span class="cx"> lowerCaseFoobar.value = 'WebKit2'
</span><span class="cx"> var oldAttributeNode2 = document.documentElement.setAttributeNode(lowerCaseFoobar);
</span><span class="cx"> 
</span><del>-shouldBe('oldAttributeNode2', 'null');
</del><ins>+shouldBe('oldAttributeNode2', 'camelCaseFoobar');
</ins><span class="cx"> 
</span><span class="cx"> shouldBeEqualToString('document.documentElement.getAttribute(&quot;foobar&quot;)', 'WebKit2');
</span><span class="cx"> shouldBeTrue('document.documentElement.hasAttribute(&quot;foobar&quot;)');
</span><span class="lines">@@ -56,8 +56,8 @@
</span><span class="cx"> 
</span><span class="cx"> shouldBeEqualToString('document.documentElement.getAttributeNS(&quot;&quot;, &quot;foobar&quot;)', 'WebKit2');
</span><span class="cx"> shouldBeTrue('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;foobar&quot;)');
</span><del>-shouldBeEqualToString('document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;)', 'Rocks!');
-shouldBeTrue('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;)');
</del><ins>+shouldBeNull('document.documentElement.getAttributeNS(&quot;&quot;, &quot;FooBar&quot;)');
+shouldBeFalse('document.documentElement.hasAttributeNS(&quot;&quot;, &quot;FooBar&quot;)');
</ins><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-01-18  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        createAttribute should lowercase the attribute name in a HTML document
+        https://bugs.webkit.org/show_bug.cgi?id=153112
+
+        Reviewed by Darin Adler.
+
+        Rebaseline a test now that it's passing all test cases.
+
+        * web-platform-tests/dom/nodes/Document-createAttribute-expected.txt:
+
</ins><span class="cx"> 2016-01-18  Xabier Rodriguez Calvar  &lt;calvaris@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Streams API] Import tests updated to Jan 13 2016
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomnodesDocumentcreateAttributeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createAttribute-expected.txt (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createAttribute-expected.txt        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createAttribute-expected.txt        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx"> PASS XML document.createAttribute(&quot;0:a&quot;) 
</span><span class="cx"> PASS HTML document.createAttribute(&quot;title&quot;) 
</span><span class="cx"> PASS XML document.createAttribute(&quot;title&quot;) 
</span><del>-FAIL HTML document.createAttribute(&quot;TITLE&quot;) assert_equals: expected &quot;title&quot; but got &quot;TITLE&quot;
</del><ins>+PASS HTML document.createAttribute(&quot;TITLE&quot;) 
</ins><span class="cx"> PASS XML document.createAttribute(&quot;TITLE&quot;) 
</span><span class="cx"> PASS HTML document.createAttribute(null) 
</span><span class="cx"> PASS XML document.createAttribute(null) 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/Source/WebCore/ChangeLog        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-01-18  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        createAttribute should lowercase the attribute name in a HTML document
+        https://bugs.webkit.org/show_bug.cgi?id=153112
+
+        Reviewed by Darin Adler.
+
+        In a HTML document, we should always lowercase localName in document.createAttribute as specified in
+        https://dom.spec.whatwg.org/#dom-document-createattribute:
+
+        1. If localName does not match the Name production in XML, throw an InvalidCharacterError exception.
+        2. If the context object is an HTML document, let localName be converted to ASCII lowercase.
+        3. Return a new attribute whose local name is localName.
+
+        Change WebKit's behavior to match the spec as well as Firefox. document.createAttributeNS will
+        continue to preserve the case as spec'ed.
+
+        No new tests are added since the behavior change is covered by existing tests.
+
+        * dom/Document.cpp:
+        (WebCore::Document::createAttribute):
+
</ins><span class="cx"> 2016-01-18  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Modern IDB: Add private-browsing variant for many IDB tests, and enable private browsing in Modern IDB.
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (195247 => 195248)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-01-19 07:37:32 UTC (rev 195248)
</span><span class="lines">@@ -4919,7 +4919,7 @@
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;Attr&gt; Document::createAttribute(const String&amp; name, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><del>-    return createAttributeNS(String(), name, ec, true);
</del><ins>+    return createAttributeNS(String(), isHTMLDocument() ? name.convertToASCIILowercase() : name, ec, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;Attr&gt; Document::createAttributeNS(const String&amp; namespaceURI, const String&amp; qualifiedName, ExceptionCode&amp; ec, bool shouldIgnoreNamespaceChecks)
</span></span></pre>
</div>
</div>

</body>
</html>