OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <body> |
| 5 <x-a id="q"></x-a> |
| 6 <script> |
| 7 t = async_test('removed callback'); |
| 8 t.calls = []; |
| 9 |
| 10 t.step(function () { |
| 11 function removed() { |
| 12 t.calls.push(this.id); |
| 13 } |
| 14 |
| 15 var proto = Object.create(HTMLElement.prototype); |
| 16 proto.removedCallback = removed; |
| 17 var ctor = document.register('x-a', {prototype: proto}); |
| 18 |
| 19 var element = new ctor(); |
| 20 element.id = 'r'; |
| 21 document.body.appendChild(element); |
| 22 element.remove(); |
| 23 assert_array_equals(t.calls, [], 'removed must be queued, not called'); |
| 24 |
| 25 document.querySelector('#q').remove(); |
| 26 assert_array_equals(t.calls, [], 'removed must be queued, not called'); |
| 27 }); |
| 28 </script> |
| 29 <script> |
| 30 t.step(function () { |
| 31 assert_array_equals(t.calls, ['r', 'q'], 'callbacks should be delivered in t
he order that they were queued'); |
| 32 t.done(); |
| 33 }); |
| 34 </script> |
OLD | NEW |