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

Side by Side Diff: LayoutTests/fast/dom/custom/callbacks-upgrade.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
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <body>
5 <x-a id="a"></x-a>
6 <x-a id="b"></x-a>
7 <x-a id="c"></x-a>
8 <script>
9 test(function () {
10 var b = document.querySelector('#b');
11 b.remove();
12
13 var calls = [];
14
15 var proto = Object.create(HTMLElement.prototype);
16 proto.readyCallback = function () {
17 calls.push(this.id + ' ready');
18 };
19 proto.insertedCallback = function () {
20 calls.push(this.id + ' inserted');
21 };
22 proto.removedCallback = function () {}
23
24 var ctor = document.register('x-a', {prototype: proto});
25
26 // FIXME: Simplify this after
27 // <https://www.w3.org/Bugs/Public/show_bug.cgi?id=22455> is fixed.
28 var call_set = calls.slice();
29 call_set.sort();
30 assert_array_equals(call_set, ['a inserted', 'a ready', 'b ready', 'c insert ed', 'c ready'], 'the callbacks should have been invoked during registration');
31
32 for (var i = 0; i < calls.length; i++) {
33 switch (calls[i]) {
34 case 'a ready':
35 assert_equals(calls[i + 1], 'a inserted');
36 break;
37 case 'c ready':
38 assert_equals(calls[i + 1], 'c inserted');
39 break;
40 }
41 }
42 }, 'element upgrade callbacks');
43 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698