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

Side by Side Diff: LayoutTests/fast/dom/custom/lifecycle-ready-innerHTML.html

Issue 17707002: Implement Custom Elements inserted and removed callbacks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../js/resources/js-test-pre.js"></script> 2 <script src="../../js/resources/js-test-pre.js"></script>
3 <div id="container"></div> 3 <div id="container"></div>
4 <script> 4 <script>
5 description('This test ensures that the lifecycle callback of a parser-made elem ent is visible in the following script block.') 5 description('This test ensures that the lifecycle callback of a parser-made elem ent is visible in the following script block.')
6 6
7 window.callbacksCalled = []; 7 window.callbacksCalled = [];
8 8
9 function ready() { 9 function ready() {
10 window.callbacksCalled.push(this.id); 10 window.callbacksCalled.push(this.id);
11 } 11 }
12 12
13 var fooProto = Object.create(HTMLElement.prototype); 13 var fooProto = Object.create(HTMLElement.prototype);
14 fooProto.readyCallback = ready; 14 fooProto.readyCallback = ready;
15 document.register('x-foo', {prototype: fooProto}); 15 document.register('x-foo', {prototype: fooProto});
16 16
17 var barProto = Object.create(HTMLDivElement.prototype); 17 var barProto = Object.create(HTMLDivElement.prototype);
18 barProto.readyCallback = ready; 18 barProto.readyCallback = ready;
19 document.register('x-bar', {prototype: barProto}); 19 document.register('x-bar', {prototype: barProto});
20 20
21 // Testing element siblings 21 // Testing element siblings
22 window.callbacksCalled = []; 22 window.callbacksCalled = [];
23 container.innerHTML = '<x-foo id="a"></x-foo>' + 23 container.innerHTML = '<x-foo id="a"></x-foo>' +
24 '<div id="b" is="x-bar"></div>' + 24 '<div id="b" is="x-bar"></div>' +
25 '<x-foo id="c"></x-foo>'; 25 '<x-foo id="c"></x-foo>';
26 shouldBe('window.callbacksCalled', '[]'); 26 shouldBe('window.callbacksCalled', '[]');
27 </script> 27 </script>
28 <script> 28 <script>
29 shouldBe('window.callbacksCalled', '[\'a\', \'b\', \'c\']'); 29 shouldBe('window.callbacksCalled', '[\'c\', \'b\', \'a\']');
30 30
31 // Testing nested elements 31 // Testing nested elements
32 window.callbacksCalled = []; 32 window.callbacksCalled = [];
33 container.innerHTML = '<x-foo id="a"><div id="b" is="x-bar"><x-foo id="c"></x-fo o></div></x-foo>'; 33 container.innerHTML = '<x-foo id="a"><div id="b" is="x-bar"><x-foo id="c"></x-fo o></div></x-foo>';
34 shouldBe('window.callbacksCalled', '[]'); 34 shouldBe('window.callbacksCalled', '[]');
35 </script> 35 </script>
36 <script> 36 <script>
37 shouldBe('window.callbacksCalled', '[\'a\', \'b\', \'c\']'); 37 shouldBe('window.callbacksCalled', '[\'c\', \'b\', \'a\']');
38 38
39 successfullyParsed = true; 39 successfullyParsed = true;
40 </script> 40 </script>
41 <script src="../../js/resources/js-test-post.js"></script> 41 <script src="../../js/resources/js-test-post.js"></script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698