summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/duplicate-ids-document-order.html
diff options
context:
space:
mode:
authordarin <darin@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2007-10-18 03:28:22 +0000
committerdarin <darin@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2007-10-18 03:28:22 +0000
commitd71fc976392660d03b56c3d557a9ca3df5798fd1 (patch)
tree7a9cbf5cc3a1f63fb362873ac4143008159d099b /third_party/WebKit/LayoutTests/fast/dom/duplicate-ids-document-order.html
parent11b57c3ae1d53b683846c1ae7cddbdb99943d5e5 (diff)
downloadchromium_src-d71fc976392660d03b56c3d557a9ca3df5798fd1.zip
chromium_src-d71fc976392660d03b56c3d557a9ca3df5798fd1.tar.gz
chromium_src-d71fc976392660d03b56c3d557a9ca3df5798fd1.tar.bz2
WebCore:
Reviewed by Darin, Adam, and Maciej. http://bugs.webkit.org/show_bug.cgi?id=12988 First element (in document order) is not returned when other duplicate ID-ed elements were created first Reset the element id cache when an id is added and there is a duplicate for that id. * dom/Document.cpp: (WebCore::Document::addElementById): LayoutTests: Reviewed by Darin, Adam, and Maciej. Testcase for: http://bugs.webkit.org/show_bug.cgi?id=12988 First element (in document order) is not returned when other duplicate ID-ed elements were created first * fast/dom/duplicate-ids-document-order.html: Added. git-svn-id: svn://svn.chromium.org/blink/trunk@26732 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/dom/duplicate-ids-document-order.html')
-rw-r--r--third_party/WebKit/LayoutTests/fast/dom/duplicate-ids-document-order.html37
1 files changed, 37 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/dom/duplicate-ids-document-order.html b/third_party/WebKit/LayoutTests/fast/dom/duplicate-ids-document-order.html
new file mode 100644
index 0000000..5fdba94
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/duplicate-ids-document-order.html
@@ -0,0 +1,37 @@
+<html>
+<head>
+<script>
+function debug(str) {
+ text = document.createTextNode(str);
+ debugDiv = document.getElementById('debugDiv');
+ div = document.createElement('div');
+ div.appendChild(text);
+ debugDiv.appendChild(div);
+}
+
+function runTest() {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ }
+ var div = document.getElementById("foo");
+ for (var i = 0; i < 5; ++i) {
+ var span = document.createElement("span");
+ span.appendChild(document.createTextNode(i));
+ span.setAttribute("id", "bar");
+ div.insertBefore(span, div.firstChild);
+ }
+
+ if (document.getElementById("bar").innerHTML == 4)
+ debug("Success");
+ else
+ debug("Failure");
+}
+</script>
+</head>
+<body onload="runTest()">
+This tests that getElementById returns the first element in document order when there are multiple ids. Bug 12988.
+<div style="display:none" id="foo">text</div>
+<div id='debugDiv'>
+</div>
+</body>
+</html>