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

Side by Side Diff: LayoutTests/fast/dom/custom/inserted-callback.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 <div id="containsQ">
6 <x-a id="q"></x-a>
7 </div>
8 <script>
9 t = async_test('inserted callback');
10 t.calls = [];
11
12 t.step(function () {
13 function inserted() {
14 t.calls.push(this.id);
15 }
16
17 var proto = Object.create(HTMLElement.prototype);
18 proto.insertedCallback = inserted;
19 var ctor = document.register('x-a', {prototype: proto});
20 assert_array_equals(t.calls, ['q'], 'register must invoke inserted');
21 t.calls = [];
22
23 var contains_q = document.querySelector('#containsQ');
24 contains_q.remove();
25 document.body.appendChild(contains_q);
26 assert_array_equals(t.calls, [], 'inserted must be queued, not called');
27
28 var r = new ctor();
29 r.id = 'r';
30 document.body.appendChild(r);
31 assert_array_equals(t.calls, [], 'inserted must be queued, not called');
32 });
33 </script>
34 <script>
35 t.step(function () {
36 assert_array_equals(t.calls, ['q', 'r'], 'callbacks should be delivered in t he order that they were queued');
37 t.done();
38 });
39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698