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

Side by Side Diff: LayoutTests/fast/dom/ParentNode/prepend.html

Issue 1085843002: Implement DOM: prepend, append, before, after & replaceWith (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <script>
5
6 test(function() {
7 var node = document.createElement('node');
8 assert_true('prepend' in node);
9 assert_equals(typeof node.prepend, 'function');
10 assert_equals(node.prepend.length, 0);
11 }, "Element should support prepend()");
12
13 test(function() {
14 var parent = document.createElement('div');
15 var test = document.createComment('test');
16 parent.appendChild(test);
17 var x = document.createElement('x');
18 var z = document.createElement('z');
19
20 parent.prepend(x, 'y', z);
21
22 assert_equals(parent.childNodes.length, 4, 'parent should have 4 children');
23 assert_equals(parent.firstChild, x, 'parent\'s first child should be x');
24 assert_equals(parent.childNodes[1].data, 'y', 'parent\'s second child should b e "y"');
25 assert_equals(parent.childNodes[2], z, 'parent\'s third child should be z');
26 assert_equals(parent.lastChild, test, 'parent\'s last child should be test');
27 }, "prepend() should work for Element");
28 </script>
29 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698