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

Side by Side Diff: LayoutTests/fast/dom/custom/document-register-on-create-callback.html

Issue 144023016: Separate Custom Element resolution and upgrade/createdCallback. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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/custom/document-register-on-create-callback-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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script> 2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
3 <script> 4 <script>
4 description('document.registerElement() in a createdCallback should upgrade elem ents that are in the same processing queue.'); 5 (function() {
6
7 var test = async_test('document.registerElement() in a createdCallback should up grade elements that are in the same processing queue.');
5 8
6 var createdElements = []; 9 var createdElements = [];
7 10
8 var protoA = Object.create(HTMLElement.prototype); 11 var protoA = Object.create(HTMLElement.prototype);
9 protoA.createdCallback = function () { 12 protoA.createdCallback = function() {
10 createdElements.push(this.id); 13 createdElements.push(this.id);
11 var protoB = Object.create(HTMLElement.prototype); 14 var protoB = Object.create(HTMLElement.prototype);
12 protoB.createdCallback = function () { 15 protoB.createdCallback = function () {
13 createdElements.push(this.id); 16 createdElements.push(this.id);
14 }; 17 };
15 18
16 document.registerElement('x-b', {prototype: protoB}); 19 document.registerElement('x-b', {prototype: protoB});
17 shouldBe('createdElements', '["elemA0", "elemB0"]'); 20 test.step(function() {
21 assert_array_equals(createdElements, ['elemA0', 'elemB0', 'elemB1']);
22 test.done();
23 });
18 }; 24 };
19 25
20 document.registerElement('x-a', {prototype: protoA}); 26 document.registerElement('x-a', {prototype: protoA});
27
28 })();
21 </script> 29 </script>
22 <x-b id='elemB0'></x-b> 30 <x-b id='elemB0'></x-b>
23 <x-a id='elemA0'></x-a> 31 <x-a id='elemA0'></x-a>
24 <x-b id='elemB1'></x-b> 32 <x-b id='elemB1'></x-b>
25 <script>
26 shouldBe('createdElements', '["elemA0", "elemB0", "elemB1"]');
27 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/custom/document-register-on-create-callback-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698