| Index: LayoutTests/fast/dom/custom/callbacks-upgrade.html
|
| diff --git a/LayoutTests/fast/dom/custom/callbacks-upgrade.html b/LayoutTests/fast/dom/custom/callbacks-upgrade.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..aa4d65fe106490d6564ecb3c67db6b283d405141
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/dom/custom/callbacks-upgrade.html
|
| @@ -0,0 +1,43 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../../resources/testharness.js"></script>
|
| +<script src="../../../resources/testharnessreport.js"></script>
|
| +<body>
|
| +<x-a id="a"></x-a>
|
| +<x-a id="b"></x-a>
|
| +<x-a id="c"></x-a>
|
| +<script>
|
| +test(function () {
|
| + var b = document.querySelector('#b');
|
| + b.remove();
|
| +
|
| + var calls = [];
|
| +
|
| + var proto = Object.create(HTMLElement.prototype);
|
| + proto.readyCallback = function () {
|
| + calls.push(this.id + ' ready');
|
| + };
|
| + proto.insertedCallback = function () {
|
| + calls.push(this.id + ' inserted');
|
| + };
|
| + proto.removedCallback = function () {}
|
| +
|
| + var ctor = document.register('x-a', {prototype: proto});
|
| +
|
| + // FIXME: Simplify this after
|
| + // <https://www.w3.org/Bugs/Public/show_bug.cgi?id=22455> is fixed.
|
| + var call_set = calls.slice();
|
| + call_set.sort();
|
| + assert_array_equals(call_set, ['a inserted', 'a ready', 'b ready', 'c inserted', 'c ready'], 'the callbacks should have been invoked during registration');
|
| +
|
| + for (var i = 0; i < calls.length; i++) {
|
| + switch (calls[i]) {
|
| + case 'a ready':
|
| + assert_equals(calls[i + 1], 'a inserted');
|
| + break;
|
| + case 'c ready':
|
| + assert_equals(calls[i + 1], 'c inserted');
|
| + break;
|
| + }
|
| + }
|
| +}, 'element upgrade callbacks');
|
| +</script>
|
|
|