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

Side by Side Diff: LayoutTests/fast/dom/custom/element-upgrade.html

Issue 23009004: Process Custom Elements in post-order. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing. 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 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('Tests the element upgrade algorithm.'); 5 description('Tests the element upgrade algorithm.');
6 6
7 // "Element Upgrade" is the processing of custom elements which were 7 // "Element Upgrade" is the processing of custom elements which were
8 // created before their definition was available, when the definition 8 // created before their definition was available, when the definition
9 // becomes available. The following scenarios cover a lot but are not 9 // becomes available. The following scenarios cover a lot but are not
10 // exhaustive. 10 // exhaustive.
(...skipping 27 matching lines...) Expand all
38 shouldBe('Object.getPrototypeOf(element)', 'HTMLElement.prototype'); 38 shouldBe('Object.getPrototypeOf(element)', 'HTMLElement.prototype');
39 39
40 // Scenario D: The candidate is a type extension, but the definition 40 // Scenario D: The candidate is a type extension, but the definition
41 // extends a different tag. Upgrade should not happen. 41 // extends a different tag. Upgrade should not happen.
42 document.body.appendChild(host); 42 document.body.appendChild(host);
43 host.innerHTML = '<span is="x-d"></span>'; 43 host.innerHTML = '<span is="x-d"></span>';
44 var D = document.register('x-d', {prototype: Object.create(HTMLDivElement.protot ype)}); 44 var D = document.register('x-d', {prototype: Object.create(HTMLDivElement.protot ype)});
45 shouldBeFalse('host.firstChild instanceof D'); 45 shouldBeFalse('host.firstChild instanceof D');
46 shouldBe('document.querySelector(":unresolved")', 'host.firstChild'); 46 shouldBe('document.querySelector(":unresolved")', 'host.firstChild');
47 47
48 // Scenario E: The order of upgrades should be the reverse of their creation. 48 // Scenario E: The order of upgrades should be the order of completing parsing.
49 // Use a good number of elements to avoid false positives from random correct or dering. 49 // Use a good number of elements to avoid false positives from random correct or dering.
50 host.innerHTML = '<x-e id="e1"><x-e id="e2"></x-e></x-e><x-e id="e3"></x-e><x-e id="e4"></x-e><x-e id="e5"></x-e>'; 50 host.innerHTML = '<x-e id="e1"><x-e id="e2"></x-e></x-e><x-e id="e3"></x-e><x-e id="e4"></x-e><x-e id="e5"></x-e>';
51 var upgradedOrder = []; 51 var upgradedOrder = [];
52 var protoE = Object.create(HTMLElement.prototype); 52 var protoE = Object.create(HTMLElement.prototype);
53 protoE.createdCallback = function() { upgradedOrder.push(this.id); }; 53 protoE.createdCallback = function() { upgradedOrder.push(this.id); };
54 document.register('x-e', {prototype: protoE}); 54 document.register('x-e', {prototype: protoE});
55 shouldBe('upgradedOrder', '["e5","e4","e3","e2","e1"]'); 55 shouldBe('upgradedOrder', '["e2","e1","e3","e4","e5"]');
56 56
57 successfullyParsed = true; 57 successfullyParsed = true;
58 </script> 58 </script>
59 <script src="../../js/resources/js-test-post.js"></script> 59 <script src="../../js/resources/js-test-post.js"></script>
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/custom/created-callback.html ('k') | LayoutTests/fast/dom/custom/element-upgrade-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698