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

Side by Side Diff: LayoutTests/fast/dom/custom/transfer-callbacks.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 <script>
6 t = async_test('transfer callbacks');
7 t.gets = [];
8 t.calls = [];
9
10 t.step(function () {
11 function getter(name) {
12 return function () {
13 t.gets.push(name);
14 return function () {
15 t.calls.push(name);
16 };
17 };
18 }
19
20 var proto = Object.create(HTMLElement.prototype, {
21 insertedCallback: {
22 get: getter('inserted')
23 },
24 readyCallback: {
25 get: getter('ready')
26 },
27 removedCallback: {
28 get: getter('removed')
29 }
30 });
31
32 var ctor = document.register('x-a', {prototype: proto});
33 assert_array_equals(t.gets, ['ready', 'inserted', 'removed'], 'the callbacks must have been retrieved in the correct order');
34
35 function failer() {
36 assert_unreached('the callbacks must not be retrieved after registration ');
37 }
38 proto.readyCallback = proto.insertedCallback = proto.removedCallback = faile r;
39
40 var element = new ctor();
41 document.body.appendChild(element);
42 element.remove();
43 });
44 </script>
45 <script>
46 t.step(function () {
47 assert_array_equals(t.calls, ['ready', 'inserted', 'removed'], 'the retrieve d callbacks should have been invoked');
48 t.done();
49 t = null;
50 });
51 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698