| Index: third_party/WebKit/LayoutTests/fast/dom/Element/getAttribute-check-case-sensitivity.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/Element/getAttribute-check-case-sensitivity.html b/third_party/WebKit/LayoutTests/fast/dom/Element/getAttribute-check-case-sensitivity.html
|
| index 0e5270cf3f18eec39aa5ef9688f76d138ae1acd7..7f161b50416601ce76e1a3bd78b960ed62d070e7 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/dom/Element/getAttribute-check-case-sensitivity.html
|
| +++ b/third_party/WebKit/LayoutTests/fast/dom/Element/getAttribute-check-case-sensitivity.html
|
| @@ -4,6 +4,148 @@
|
| <script src="../../../resources/js-test.js"></script>
|
| </head>
|
| <body>
|
| -<script src="script-tests/getAttribute-check-case-sensitivity.js"></script>
|
| +<script>
|
| +description(
|
| +"<p>This file test the behaviour of getAttribute with regard to case.</p><p>See Bug 20247: setAttributeNode() does not work when attribute name has a capital letter in it</p>"
|
| +);
|
| +
|
| +function testGetAttributeCaseInsensitive()
|
| +{
|
| + var div = document.createElement('div');
|
| + div.setAttribute("mixedCaseAttrib", "x");
|
| +
|
| + // Do original case lookup, and lowercase lookup.
|
| + return div.getAttribute("mixedcaseattrib");
|
| +}
|
| +
|
| +shouldBe("testGetAttributeCaseInsensitive()", '"x"');
|
| +
|
| +function testGetAttributeNodeMixedCase()
|
| +{
|
| + var div = document.createElement('div');
|
| + var a = div.ownerDocument.createAttribute("mixedCaseAttrib");
|
| + a.value = "x";
|
| + div.setAttributeNode(a);
|
| + return div.getAttribute("mixedCaseAttrib");
|
| +}
|
| +
|
| +shouldBe("testGetAttributeNodeMixedCase()", '"x"');
|
| +
|
| +function testGetAttributeNodeLowerCase(div)
|
| +{
|
| + var div = document.createElement('div');
|
| + var a = div.ownerDocument.createAttribute("lowercaseattrib");
|
| + a.value = "x";
|
| + div.setAttributeNode(a);
|
| + return div.getAttribute("lowerCaseAttrib");
|
| +}
|
| +
|
| +shouldBe("testGetAttributeNodeLowerCase()", '"x"');
|
| +
|
| +function testSetAttributeNodeKeepsRef(div)
|
| +{
|
| + var div = document.createElement('div');
|
| + var a = div.ownerDocument.createAttribute("attrib_name");
|
| + a.value = "0";
|
| + div.setAttributeNode(a);
|
| +
|
| + // Mutate the attribute node.
|
| + a.value = "1";
|
| +
|
| + return div.getAttribute("attrib_name");
|
| +}
|
| +
|
| +shouldBe("testSetAttributeNodeKeepsRef()", '"1"');
|
| +
|
| +function testAttribNodeNamePreservesCase()
|
| +{
|
| + var div = document.createElement('div');
|
| + var a = div.ownerDocument.createAttribute("A");
|
| + a.value = "x";
|
| + div.setAttributeNode(a);
|
| +
|
| + var result = [ a.name, a.nodeName ];
|
| + return result.join(",");
|
| +}
|
| +
|
| +shouldBe("testAttribNodeNamePreservesCase()", '"a,a"');
|
| +
|
| +
|
| +function testAttribNodeNamePreservesCaseGetNode()
|
| +{
|
| + // getAttributeNode doesn't work on DIVs, use body element
|
| + var body = document.body;
|
| +
|
| + var a = body.ownerDocument.createAttribute("A");
|
| + a.value = "x";
|
| +
|
| + body.setAttributeNode(a);
|
| +
|
| + a = document.body.getAttributeNode("A");
|
| + if (!a)
|
| + return "FAIL";
|
| +
|
| + var result = [ a.name, a.nodeName ];
|
| + return result.join(",");
|
| +}
|
| +
|
| +shouldBe("testAttribNodeNamePreservesCaseGetNode()", '"a,a"');
|
| +
|
| +function testAttribNodeNamePreservesCaseGetNode2()
|
| +{
|
| + // getAttributeNode doesn't work on DIVs, use body element
|
| + var body = document.body;
|
| +
|
| + var a = body.ownerDocument.createAttribute("B");
|
| + a.value = "x";
|
| +
|
| + body.setAttributeNode(a);
|
| +
|
| + a = document.body.getAttributeNode("B");
|
| + if (!a)
|
| + return "FAIL";
|
| +
|
| + // Now create node second time -- this time case is preserved in FF!
|
| + a = body.ownerDocument.createAttribute("B");
|
| + a.value = "x";
|
| + body.setAttributeNode(a);
|
| +
|
| + a = document.body.getAttributeNode("B");
|
| +
|
| + var result = [ a.name, a.nodeName ];
|
| + return result.join(",");
|
| +}
|
| +
|
| +shouldBe("testAttribNodeNamePreservesCaseGetNode2()", '"b,b"');
|
| +
|
| +function testAttribNodeNameGetMutate()
|
| +{
|
| + // getAttributeNode doesn't work on DIVs, use body element.
|
| + var body = document.body;
|
| +
|
| + var a = body.ownerDocument.createAttribute("c");
|
| + a.value = "0";
|
| + body.setAttributeNode(a);
|
| +
|
| + a = document.body.getAttributeNode("c");
|
| + a.value = "1";
|
| +
|
| + a = document.body.getAttributeNode("c");
|
| +
|
| + return a.value;
|
| +}
|
| +
|
| +shouldBe("testAttribNodeNameGetMutate()", '"1"');
|
| +
|
| +var node = document.createElement("div");
|
| +var attrib = document.createAttribute("myAttrib");
|
| +attrib.value = "XXX";
|
| +node.setAttributeNode(attrib);
|
| +
|
| +shouldBe("(new XMLSerializer).serializeToString(node)", '"<div xmlns=\\"http://www.w3.org/1999/xhtml\\" myattrib=\\"XXX\\"></div>"');
|
| +shouldBe("node.getAttributeNode('myAttrib').name", '"myattrib"');
|
| +shouldBe("node.getAttributeNode('myattrib').name", '"myattrib"');
|
| +shouldBe("attrib.name", '"myattrib"');
|
| +</script>
|
| </body>
|
| </html>
|
|
|