Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html

Issue 22803008: setAttributeNode() does not properly normalize case. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html
diff --git a/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html b/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html
new file mode 100644
index 0000000000000000000000000000000000000000..dbba85e3deea1086f66045cfed829efbee902c3e
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/setAttributeNode-case-insensitivity.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script>
+function runTest()
+{
+ description("This test verifies that the setAttributeNode() API checks for existing attributes case-insensitively. Thus the value of an existing attribute with the same name but in a different case should get replaced by the new value specified via the setAttributeNode() method.");
+
+ var test = document.getElementById("test");
+ var newStyleAttr = document.createAttribute("STYLE");
+ newStyleAttr.value = "background-color: green";
+ test.setAttributeNode(newStyleAttr);
+ if (window.testRunner) {
+ shouldBe("test.getAttribute('style')", "test.getAttribute('STYLE')");
+ shouldBe("test.getAttributeNode('style').value", "test.getAttributeNode('STYLE').value");
+ }
+
+ 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.");
+ var newAttr1 = document.createAttributeNS("ns1", "newattr");
+ newAttr1.prefix = "prefix1";
+ newAttr1.value = "newattr1";
+ test.setAttributeNode(newAttr1);
+ var newAttr2 = document.createAttributeNS("ns2", "newattr");
+ newAttr2.prefix = "prefix2";
+ newAttr2.value = "newattr2";
+ test.setAttributeNode(newAttr2);
+ if (window.testRunner) {
+ shouldBe("test.getAttributeNodeNS('ns1', 'newattr').value", "'newattr1'");
+ shouldBe("test.getAttributeNodeNS('ns2', 'newattr').value", "'newattr2'");
+ }
+
+ debug("Verifying that attributes with same name but different case and having same namespaces are treated as same. In the following test the new attribute should overwrite the value of the existing one.");
+ var newAttr3 = document.createAttributeNS("ns1", "NEWATTR");
+ newAttr3.prefix = "prefix2";
+ newAttr3.value = "newattr3";
+ test.setAttributeNode(newAttr3);
+
+ if (window.testRunner) {
+ shouldBe("test.getAttributeNodeNS('ns1', 'newattr').value", "'newattr3'");
+
+ isSuccessfullyParsed();
+ test.style.display = 'none';
+ }
+
+}
+</script>
+</head>
+<body onload="runTest()">
+<div>Test for Bugzilla bug:<a href="https://bugs.webkit.org/show_bug.cgi?id=90341"> 90341:</a> createAttribute/setAttributeNode does not properly normalize case.</div>
+<div id="test" style="background-color: red">&nbsp;</div>
+<div id="description"></div>
+<div id="console"></div>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698