Index: LayoutTests/fast/dom/custom/removed-callback.html |
diff --git a/LayoutTests/fast/dom/custom/removed-callback.html b/LayoutTests/fast/dom/custom/removed-callback.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..135860c2e17eed199e88943c487451403ef08b91 |
--- /dev/null |
+++ b/LayoutTests/fast/dom/custom/removed-callback.html |
@@ -0,0 +1,34 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<body> |
+<x-a id="q"></x-a> |
+<script> |
+t = async_test('removed callback'); |
+t.calls = []; |
+ |
+t.step(function () { |
+ function removed() { |
+ t.calls.push(this.id); |
+ } |
+ |
+ var proto = Object.create(HTMLElement.prototype); |
+ proto.removedCallback = removed; |
+ var ctor = document.register('x-a', {prototype: proto}); |
+ |
+ var element = new ctor(); |
+ element.id = 'r'; |
+ document.body.appendChild(element); |
+ element.remove(); |
+ assert_array_equals(t.calls, [], 'removed must be queued, not called'); |
+ |
+ document.querySelector('#q').remove(); |
+ assert_array_equals(t.calls, [], 'removed must be queued, not called'); |
+}); |
+</script> |
+<script> |
+t.step(function () { |
+ assert_array_equals(t.calls, ['r', 'q'], 'callbacks should be delivered in the order that they were queued'); |
+ t.done(); |
+}); |
+</script> |