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

Side by Side Diff: LayoutTests/fast/dom/DocumentFragment/get-element-by-id.html

Issue 251633002: Add support for DocumentFragment.getElementById() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix createElement() calls Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/dom/DocumentFragment/get-element-by-id-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <link rel="help" href="http://dom.spec.whatwg.org/#interface-nonelementparentnod e">
5 <script src="../../../resources/js-test.js"></script>
6 </head>
7 <body>
8 <div id="notInFragment"></div>
9 <div id="duplicateId1"></div>
10 <script>
11 description("Tests that getElementById() API is exposed on DocumentFragment node s.");
12
13 var fragment = new DocumentFragment();
14 var div = document.createElement("div");
15 div.id = "divID";
16 fragment.appendChild(div);
17 var a = document.createElement("a");
18 a.id = "aID";
19 div.appendChild(a);
20 var span = document.createElement("span");
21 span.id = "duplicateId1";
22 div.appendChild(span);
23 var h1 = document.createElement("h1");
24 h1.id = "duplicateId2";
25 div.appendChild(h1);
26 var h2 = document.createElement("h2");
27 h2.id = "duplicateId2";
28 div.appendChild(h2);
29
30 shouldBe("fragment.getElementById('divID')", "div");
31 shouldBe("fragment.getElementById('aID')", "a");
32 shouldBeNull("fragment.getElementById('notInFragment')");
33 shouldBeNull("fragment.getElementById('doesNotExist')");
34
35 // Duplicate ID cases.
36 shouldBe("fragment.getElementById('duplicateId1')", "span"); // Should return th e Element *inside* the DocumentFragment.
37 shouldBe("fragment.getElementById('duplicateId2')", "h1"); // Should return the first matching Element in case of duplicate.
38 </script>
39 </body>
40 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/DocumentFragment/get-element-by-id-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698