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

Side by Side Diff: LayoutTests/fast/dom/custom/created-callback.html

Issue 18258003: Pow __proto__, sock :unresolved, and clunk the created callback at once. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Try to be nicer to MSVC. Created 7 years, 5 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/created-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/testharness.js"></script> 2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script> 3 <script src="../../../resources/testharnessreport.js"></script>
4 <body> 4 <body>
5 <script> 5 <script>
6 test(function () { 6 test(function () {
7 var createdInvocations = 0; 7 var createdInvocations = 0;
8 function created() { 8 function created() {
9 createdInvocations++; 9 createdInvocations++;
10 } 10 }
(...skipping 13 matching lines...) Expand all
24 get: getter 24 get: getter
25 } 25 }
26 }); 26 });
27 var ctor = document.register('x-a', {prototype: proto}); 27 var ctor = document.register('x-a', {prototype: proto});
28 assert_equals(getterInvocations, 1, 'the created callback must have been ret rieved'); 28 assert_equals(getterInvocations, 1, 'the created callback must have been ret rieved');
29 29
30 proto.createdCallback = failer; 30 proto.createdCallback = failer;
31 var element = new ctor(); 31 var element = new ctor();
32 assert_equals(createdInvocations, 1, 'the created callback retrieved at regi stration must be invoked'); 32 assert_equals(createdInvocations, 1, 'the created callback retrieved at regi stration must be invoked');
33 }, 'transfer created callback'); 33 }, 'transfer created callback');
34
35 t = async_test('__proto__, :unresolved and created callback timing');
36 t.step(function () {
37 var createdInvocations = 0;
38 function created() {
39 createdInvocations++;
40
41 if (this.id != 'v')
42 return;
43
44 t.step(function () {
45 var t = div.querySelector('#t');
46 var u = div.querySelector('#u');
47 var w = div.querySelector('#w');
48
49 assert_equals(div.querySelector('x-c:not(:unresolved)'), this, 'the :unresolved pseudoclass should cease to apply when the created callback is invok ed');
50 assert_array_equals(div.querySelectorAll(':unresolved'), [t, u], 'th e :unresolved pseudoclass should be processed in order');
51
52 assert_false(t instanceof C, 'prototype upgrade should happen in ord er (#t)');
53 assert_false(u instanceof B, 'prototype upgrade should happen in ord er (#u)');
54 }, this);
55 }
56
57 var protoB = Object.create(HTMLElement.prototype);
58 var B = document.register('x-b', {prototype: protoB});
59
60 var protoC = Object.create(HTMLElement.prototype);
61 protoC.createdCallback = created;
62 var C = document.register('x-c', {prototype: protoC});
63
64 var div = document.createElement('div');
65 div.innerHTML = '<x-c id="t"></x-c>' +
66 '<x-b id="u"></x-b>' +
67 '<x-c id="v"></x-c>' +
68 '<x-b id="w"></x-b>';
69 assert_equals(createdInvocations, 2, 'the created callback should have been invoked once for each x-c element');
70 assert_true(div.querySelector('#t') instanceof C, '#t\'s prototype should ha ve ultimately been upgraded');
71 t.done();
72 });
34 </script> 73 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/custom/created-callback-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698