Diff
Modified: trunk/LayoutTests/ChangeLog (195247 => 195248)
--- trunk/LayoutTests/ChangeLog 2016-01-19 06:02:30 UTC (rev 195247)
+++ trunk/LayoutTests/ChangeLog 2016-01-19 07:37:32 UTC (rev 195248)
@@ -1,3 +1,43 @@
+2016-01-18 Ryosuke Niwa <[email protected]>
+
+ 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 "aa" as well
+ as "AA" 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 "green" 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.
+
2016-01-18 Brady Eidson <[email protected]>
Modern IDB: Add private-browsing variant for many IDB tests, and enable private browsing in Modern IDB.
Modified: trunk/LayoutTests/fast/dom/Element/getAttribute-check-case-sensitivity-expected.txt (195247 => 195248)
--- 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)
@@ -9,14 +9,17 @@
PASS testGetAttributeNodeMixedCase() is "x"
PASS testGetAttributeNodeLowerCase() is "x"
PASS testSetAttributeNodeKeepsRef() is "1"
-PASS testAttribNodeNamePreservesCase() is "A,A"
-PASS testAttribNodeNamePreservesCaseGetNode() is "A,A"
+PASS testAttribNodeNamePreservesCase() is "a,a"
+PASS testAttribNodeNamePreservesCaseGetNode() is "a,a"
PASS testAttribNodeNamePreservesCaseGetNode2() is "B,B"
PASS testAttribNodeNameGetMutate() is "1"
-PASS (new XMLSerializer).serializeToString(node) is "<div xmlns=\"http://www.w3.org/1999/xhtml\" myAttrib=\"XXX\"></div>"
-PASS node.getAttributeNodeNS('', 'myAttrib').name is "myAttrib"
-PASS node.getAttributeNodeNS('', 'myattrib') is null
-PASS attrib.name is "myAttrib"
+PASS (new XMLSerializer).serializeToString(node) is "<div xmlns=\"http://www.w3.org/1999/xhtml\" myattrib=\"XXX\" myAttrib2=\"XXX\"></div>"
+PASS node.getAttributeNodeNS('', 'myattrib') is attrib
+PASS node.getAttributeNodeNS('', 'myAttrib') is null
+PASS attrib.name is "myattrib"
+PASS node.getAttributeNodeNS('', 'myAttrib2') is attrib2
+PASS node.getAttributeNodeNS('', 'myattrib2') is null
+PASS attrib2.name is "myAttrib2"
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702-expected.txt (195247 => 195248)
--- 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)
@@ -3,8 +3,8 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS document.documentElement.hasAttributeNS("", "aa") is false
-PASS document.documentElement.getAttributeNS("", "aa") is null
+PASS document.documentElement.hasAttributeNS("", "aa") is true
+PASS document.documentElement.getAttributeNS("", "aa") is "lowercase"
PASS document.documentElement.hasAttributeNS("", "AA") is true
PASS document.documentElement.getAttributeNS("", "AA") is "UPPERCASE"
PASS successfullyParsed is true
Deleted: trunk/LayoutTests/fast/dom/Element/mozilla-dom-base-tests/test_bug1075702.html (195247 => 195248)
--- 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)
@@ -1,39 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1075702
--->
-<head>
- <meta charset="utf-8">
- <script src=""
-</head>
-<body>
-<a target="_blank" href="" Mozilla Bug 1075702 </a>
-<p id="display"></p>
-
-<pre id="test"></pre>
-<script type="application/_javascript_">
-
- /** Test for Bug 1075702 **/
- // test: Element.removeAttributeNode()
- description("Test adapted from Mozilla Bug 1075702");
-
- var a1 = document.createAttribute("aa");
- a1.nodeValue = "lowercase";
-
- var a2 = document.createAttribute("AA");
- a2.nodeValue = "UPPERCASE";
-
- document.documentElement.setAttributeNode(a1);
-
- document.documentElement.setAttributeNode(a2);
-
- shouldBeFalse('document.documentElement.hasAttributeNS("", "aa")');
- shouldBeNull('document.documentElement.getAttributeNS("", "aa")');
- shouldBeTrue('document.documentElement.hasAttributeNS("", "AA")');
- shouldBeEqualToString('document.documentElement.getAttributeNS("", "AA")', 'UPPERCASE');
-
-</script>
-<script src=""
-</body>
-</html>
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)
--- 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)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1075702
+-->
+<head>
+ <meta charset="utf-8"/>
+ <script src=""
+</head>
+<body>
+<a target="_blank" href="" Mozilla Bug 1075702 </a>
+<p id="display"></p>
+
+<pre id="test"></pre>
+<script type="application/_javascript_">
+
+ /** Test for Bug 1075702 **/
+ // test: Element.removeAttributeNode()
+ description("Test adapted from Mozilla Bug 1075702");
+
+ var a1 = document.createAttribute("aa");
+ a1.nodeValue = "lowercase";
+
+ var a2 = document.createAttribute("AA");
+ a2.nodeValue = "UPPERCASE";
+
+ document.documentElement.setAttributeNode(a1);
+
+ document.documentElement.setAttributeNode(a2);
+
+ shouldBeTrue('document.documentElement.hasAttributeNS("", "aa")');
+ shouldBeEqualToString('document.documentElement.getAttributeNS("", "aa")', 'lowercase');
+ shouldBeTrue('document.documentElement.hasAttributeNS("", "AA")');
+ shouldBeEqualToString('document.documentElement.getAttributeNS("", "AA")', 'UPPERCASE');
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/dom/Element/script-tests/getAttribute-check-case-sensitivity.js (195247 => 195248)
--- 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)
@@ -19,7 +19,7 @@
var a = div.ownerDocument.createAttribute("mixedCaseAttrib");
a.nodeValue = "x";
div.setAttributeNode(a);
- return div.getAttributeNS("", "mixedCaseAttrib");
+ return div.getAttributeNS("", "mixedcaseattrib");
}
shouldBe("testGetAttributeNodeMixedCase()", '"x"');
@@ -61,7 +61,7 @@
return result.join(",");
}
-shouldBe("testAttribNodeNamePreservesCase()", '"A,A"');
+shouldBe("testAttribNodeNamePreservesCase()", '"a,a"');
function testAttribNodeNamePreservesCaseGetNode()
@@ -74,7 +74,7 @@
body.setAttributeNode(a);
- a = document.body.getAttributeNodeNS("", "A");
+ a = document.body.getAttributeNode("A");
if (!a)
return "FAIL";
@@ -82,7 +82,7 @@
return result.join(",");
}
-shouldBe("testAttribNodeNamePreservesCaseGetNode()", '"A,A"');
+shouldBe("testAttribNodeNamePreservesCaseGetNode()", '"a,a"');
function testAttribNodeNamePreservesCaseGetNode2()
{
@@ -94,12 +94,11 @@
body.setAttributeNode(a);
- a = document.body.getAttributeNodeNS("", "B");
+ a = document.body.getAttributeNodeNS("", "b");
if (!a)
return "FAIL";
- // Now create node second time -- this time case is preserved in FF!
- a = body.ownerDocument.createAttribute("B");
+ a = body.ownerDocument.createAttributeNS("", "B");
a.nodeValue = "x";
body.setAttributeNode(a);
@@ -135,7 +134,15 @@
attrib.nodeValue = "XXX";
node.setAttributeNode(attrib);
-shouldBe("(new XMLSerializer).serializeToString(node)", '"<div xmlns=\\"http://www.w3.org/1999/xhtml\\" myAttrib=\\"XXX\\"></div>"');
-shouldBe("node.getAttributeNodeNS('', 'myAttrib').name", '"myAttrib"');
-shouldBe("node.getAttributeNodeNS('', 'myattrib')", 'null');
-shouldBe("attrib.name", '"myAttrib"');
+var attrib2 = document.createAttributeNS("", "myAttrib2");
+attrib2.nodeValue = "XXX";
+node.setAttributeNode(attrib2);
+
+shouldBe("(new XMLSerializer).serializeToString(node)", '"<div xmlns=\\"http://www.w3.org/1999/xhtml\\" myattrib=\\"XXX\\" myAttrib2=\\"XXX\\"></div>"');
+shouldBe("node.getAttributeNodeNS('', 'myattrib')", 'attrib');
+shouldBeNull("node.getAttributeNodeNS('', 'myAttrib')");
+shouldBe("attrib.name", '"myattrib"');
+
+shouldBe("node.getAttributeNodeNS('', 'myAttrib2')", 'attrib2');
+shouldBeNull("node.getAttributeNodeNS('', 'myattrib2')");
+shouldBe("attrib2.name", '"myAttrib2"');
Modified: trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity-expected.txt (195247 => 195248)
--- 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)
@@ -4,7 +4,7 @@
PASS test.getAttribute('style') is test.getAttribute('STYLE')
-PASS test.getAttributeNode('style') is null
+PASS test.getAttributeNode('style') is test.getAttributeNode('STYLE')
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.
PASS test.getAttributeNodeNS('ns1', 'newattr').value is 'newattr1'
PASS test.getAttributeNodeNS('ns2', 'newattr').value is 'newattr2'
Modified: trunk/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html (195247 => 195248)
--- 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)
@@ -16,7 +16,7 @@
newStyleAttr.value = "background-color: green";
test.setAttributeNode(newStyleAttr);
shouldBe("test.getAttribute('style')", "test.getAttribute('STYLE')");
- shouldBe("test.getAttributeNode('style')", "null");
+ shouldBe("test.getAttributeNode('style')", "test.getAttributeNode('STYLE')");
debug("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.");
Modified: trunk/LayoutTests/fast/dom/Element/setAttributeNode-for-existing-attribute-expected.txt (195247 => 195248)
--- 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)
@@ -2,4 +2,4 @@
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.
-background-color specified with lowercase style attribute was: red and specified with uppercase style attribute is:
+background-color specified with lowercase style attribute was: red and specified with uppercase style attribute is: green
Modified: trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-expected.txt (195247 => 195248)
--- 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)
@@ -13,23 +13,23 @@
PASS document.documentElement.hasAttributeNS("", "FooBar") is false
PASS document.documentElement.attributes.length is 1
PASS camelCaseFoobar is not oldAttributeNode
-PASS document.documentElement.getAttribute("foobar") is null
-PASS document.documentElement.hasAttribute("foobar") is false
-PASS document.documentElement.getAttribute("FooBar") is null
-PASS document.documentElement.hasAttribute("FooBar") is false
-PASS document.documentElement.getAttributeNS("", "foobar") is null
-PASS document.documentElement.hasAttributeNS("", "foobar") is false
-PASS document.documentElement.getAttributeNS("", "FooBar") is "Rocks!"
-PASS document.documentElement.hasAttributeNS("", "FooBar") is true
-PASS oldAttributeNode2 is null
+PASS document.documentElement.getAttribute("foobar") is "Rocks!"
+PASS document.documentElement.hasAttribute("foobar") is true
+PASS document.documentElement.getAttribute("FooBar") is "Rocks!"
+PASS document.documentElement.hasAttribute("FooBar") is true
+PASS document.documentElement.getAttributeNS("", "foobar") is "Rocks!"
+PASS document.documentElement.hasAttributeNS("", "foobar") is true
+PASS document.documentElement.getAttributeNS("", "FooBar") is null
+PASS document.documentElement.hasAttributeNS("", "FooBar") is false
+PASS oldAttributeNode2 is camelCaseFoobar
PASS document.documentElement.getAttribute("foobar") is "WebKit2"
PASS document.documentElement.hasAttribute("foobar") is true
PASS document.documentElement.getAttribute("FooBar") is "WebKit2"
PASS document.documentElement.hasAttribute("FooBar") is true
PASS document.documentElement.getAttributeNS("", "foobar") is "WebKit2"
PASS document.documentElement.hasAttributeNS("", "foobar") is true
-PASS document.documentElement.getAttributeNS("", "FooBar") is "Rocks!"
-PASS document.documentElement.hasAttributeNS("", "FooBar") is true
+PASS document.documentElement.getAttributeNS("", "FooBar") is null
+PASS document.documentElement.hasAttributeNS("", "FooBar") is false
PASS successfullyParsed is true
TEST COMPLETE
Added: trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1-xml-expected.txt (0 => 195248)
--- 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)
@@ -0,0 +1,36 @@
+Test using setAttributeNode() behaves like setAttribute() to get the existing attribute, but like setAttributeNS() to set the new value."
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.documentElement.getAttribute("foobar") is null
+PASS document.documentElement.hasAttribute("foobar") is false
+PASS document.documentElement.getAttribute("FooBar") is "WebKit"
+PASS document.documentElement.hasAttribute("FooBar") is true
+PASS document.documentElement.getAttributeNS("", "foobar") is null
+PASS document.documentElement.hasAttributeNS("", "foobar") is false
+PASS document.documentElement.getAttributeNS("", "FooBar") is "WebKit"
+PASS document.documentElement.hasAttributeNS("", "FooBar") is true
+PASS document.documentElement.attributes.length is 3
+PASS camelCaseFoobar is not oldAttributeNode
+PASS document.documentElement.getAttribute("foobar") is null
+PASS document.documentElement.hasAttribute("foobar") is false
+PASS document.documentElement.getAttribute("FooBar") is "Rocks!"
+PASS document.documentElement.hasAttribute("FooBar") is true
+PASS document.documentElement.getAttributeNS("", "foobar") is null
+PASS document.documentElement.hasAttributeNS("", "foobar") is false
+PASS document.documentElement.getAttributeNS("", "FooBar") is "Rocks!"
+PASS document.documentElement.hasAttributeNS("", "FooBar") is true
+PASS oldAttributeNode2 is null
+PASS document.documentElement.getAttribute("foobar") is "WebKit2"
+PASS document.documentElement.hasAttribute("foobar") is true
+PASS document.documentElement.getAttribute("FooBar") is "Rocks!"
+PASS document.documentElement.hasAttribute("FooBar") is true
+PASS document.documentElement.getAttributeNS("", "foobar") is "WebKit2"
+PASS document.documentElement.hasAttributeNS("", "foobar") is true
+PASS document.documentElement.getAttributeNS("", "FooBar") is "Rocks!"
+PASS document.documentElement.hasAttributeNS("", "FooBar") is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
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)
--- 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)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta charset="utf-8"/>
+<script src=""
+</head>
+<body>
+ <div id="test-container" style="display: none;"></div>
+</body>
+<script>
+description('Test using setAttributeNode() behaves like setAttribute() to get the existing attribute, but like setAttributeNS() to set the new value."');
+
+document.documentElement.setAttribute('FooBar', 'WebKit');
+
+shouldBeNull('document.documentElement.getAttribute("foobar")');
+shouldBeFalse('document.documentElement.hasAttribute("foobar")');
+shouldBeEqualToString('document.documentElement.getAttribute("FooBar")', 'WebKit');
+shouldBeTrue('document.documentElement.hasAttribute("FooBar")');
+
+shouldBeNull('document.documentElement.getAttributeNS("", "foobar")', 'WebKit');
+shouldBeFalse('document.documentElement.hasAttributeNS("", "foobar")');
+shouldBeEqualToString('document.documentElement.getAttributeNS("", "FooBar")', 'WebKit');
+shouldBeTrue('document.documentElement.hasAttributeNS("", "FooBar")');
+
+
+shouldBe('document.documentElement.attributes.length', '3');
+
+// Should replace the value of "FooBar" by "WebKit".
+var camelCaseFoobar = document.createAttribute("FooBar");
+camelCaseFoobar.value = 'Rocks!'
+var oldAttributeNode = document.documentElement.setAttributeNode(camelCaseFoobar);
+
+shouldNotBe('camelCaseFoobar', 'oldAttributeNode');
+
+shouldBe('document.documentElement.getAttribute("foobar")', 'null');
+shouldBeFalse('document.documentElement.hasAttribute("foobar")');
+shouldBeEqualToString('document.documentElement.getAttribute("FooBar")', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttribute("FooBar")');
+
+shouldBe('document.documentElement.getAttributeNS("", "foobar")', 'null');
+shouldBeFalse('document.documentElement.hasAttributeNS("", "foobar")');
+shouldBeEqualToString('document.documentElement.getAttributeNS("", "FooBar")', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttributeNS("", "FooBar")');
+
+// "foobar" should exist alongside "FooBar".
+var lowerCaseFoobar = document.createAttribute("foobar");
+lowerCaseFoobar.value = 'WebKit2'
+var oldAttributeNode2 = document.documentElement.setAttributeNode(lowerCaseFoobar);
+
+shouldBe('oldAttributeNode2', 'null');
+
+shouldBeEqualToString('document.documentElement.getAttribute("foobar")', 'WebKit2');
+shouldBeTrue('document.documentElement.hasAttribute("foobar")');
+shouldBeEqualToString('document.documentElement.getAttribute("FooBar")', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttribute("FooBar")');
+
+shouldBeEqualToString('document.documentElement.getAttributeNS("", "foobar")', 'WebKit2');
+shouldBeTrue('document.documentElement.hasAttributeNS("", "foobar")');
+shouldBeEqualToString('document.documentElement.getAttributeNS("", "FooBar")', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttributeNS("", "FooBar")');
+</script>
+<script src=""
+</html>
Modified: trunk/LayoutTests/fast/dom/Element/setAttributeNode-overriding-lowercase-values-1.html (195247 => 195248)
--- 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)
@@ -25,29 +25,29 @@
shouldBe('document.documentElement.attributes.length', '1');
-// "FooBar" should nuke the "foobar" value while itself having the "FooBar" name.
+// "FooBar" should nuke the "foobar" value and itself having the "foobar" name.
var camelCaseFoobar = document.createAttribute("FooBar");
camelCaseFoobar.value = 'Rocks!'
var oldAttributeNode = document.documentElement.setAttributeNode(camelCaseFoobar);
shouldNotBe('camelCaseFoobar', 'oldAttributeNode');
-shouldBe('document.documentElement.getAttribute("foobar")', 'null');
-shouldBeFalse('document.documentElement.hasAttribute("foobar")');
-shouldBe('document.documentElement.getAttribute("FooBar")', 'null');
-shouldBeFalse('document.documentElement.hasAttribute("FooBar")');
+shouldBeEqualToString('document.documentElement.getAttribute("foobar")', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttribute("foobar")');
+shouldBeEqualToString('document.documentElement.getAttribute("FooBar")', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttribute("FooBar")');
-shouldBe('document.documentElement.getAttributeNS("", "foobar")', 'null');
-shouldBeFalse('document.documentElement.hasAttributeNS("", "foobar")');
-shouldBeEqualToString('document.documentElement.getAttributeNS("", "FooBar")', 'Rocks!');
-shouldBeTrue('document.documentElement.hasAttributeNS("", "FooBar")');
+shouldBeEqualToString('document.documentElement.getAttributeNS("", "foobar")', 'Rocks!');
+shouldBeTrue('document.documentElement.hasAttributeNS("", "foobar")');
+shouldBeNull('document.documentElement.getAttributeNS("", "FooBar")');
+shouldBeFalse('document.documentElement.hasAttributeNS("", "FooBar")');
// "foobar" should exist alongside "FooBar".
var lowerCaseFoobar = document.createAttribute("foobar");
lowerCaseFoobar.value = 'WebKit2'
var oldAttributeNode2 = document.documentElement.setAttributeNode(lowerCaseFoobar);
-shouldBe('oldAttributeNode2', 'null');
+shouldBe('oldAttributeNode2', 'camelCaseFoobar');
shouldBeEqualToString('document.documentElement.getAttribute("foobar")', 'WebKit2');
shouldBeTrue('document.documentElement.hasAttribute("foobar")');
@@ -56,8 +56,8 @@
shouldBeEqualToString('document.documentElement.getAttributeNS("", "foobar")', 'WebKit2');
shouldBeTrue('document.documentElement.hasAttributeNS("", "foobar")');
-shouldBeEqualToString('document.documentElement.getAttributeNS("", "FooBar")', 'Rocks!');
-shouldBeTrue('document.documentElement.hasAttributeNS("", "FooBar")');
+shouldBeNull('document.documentElement.getAttributeNS("", "FooBar")');
+shouldBeFalse('document.documentElement.hasAttributeNS("", "FooBar")');
</script>
<script src=""
</html>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (195247 => 195248)
--- 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)
@@ -1,3 +1,14 @@
+2016-01-18 Ryosuke Niwa <[email protected]>
+
+ 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:
+
2016-01-18 Xabier Rodriguez Calvar <[email protected]>
[Streams API] Import tests updated to Jan 13 2016
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-createAttribute-expected.txt (195247 => 195248)
--- 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)
@@ -15,7 +15,7 @@
PASS XML document.createAttribute("0:a")
PASS HTML document.createAttribute("title")
PASS XML document.createAttribute("title")
-FAIL HTML document.createAttribute("TITLE") assert_equals: expected "title" but got "TITLE"
+PASS HTML document.createAttribute("TITLE")
PASS XML document.createAttribute("TITLE")
PASS HTML document.createAttribute(null)
PASS XML document.createAttribute(null)
Modified: trunk/Source/WebCore/ChangeLog (195247 => 195248)
--- 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)
@@ -1,3 +1,25 @@
+2016-01-18 Ryosuke Niwa <[email protected]>
+
+ 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):
+
2016-01-18 Brady Eidson <[email protected]>
Modern IDB: Add private-browsing variant for many IDB tests, and enable private browsing in Modern IDB.
Modified: trunk/Source/WebCore/dom/Document.cpp (195247 => 195248)
--- 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)
@@ -4919,7 +4919,7 @@
RefPtr<Attr> Document::createAttribute(const String& name, ExceptionCode& ec)
{
- return createAttributeNS(String(), name, ec, true);
+ return createAttributeNS(String(), isHTMLDocument() ? name.convertToASCIILowercase() : name, ec, true);
}
RefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode& ec, bool shouldIgnoreNamespaceChecks)