Index: LayoutTests/fast/dom/custom/created-callback.html |
diff --git a/LayoutTests/fast/dom/custom/created-callback.html b/LayoutTests/fast/dom/custom/created-callback.html |
index ea0b735ac6df8a5f7f9979d7a5caf8b92068d0ad..2819227c483f131525165718039d019c448d443b 100644 |
--- a/LayoutTests/fast/dom/custom/created-callback.html |
+++ b/LayoutTests/fast/dom/custom/created-callback.html |
@@ -112,4 +112,33 @@ withFrame(t.step_func(function(frame) { |
})); |
})(); |
+ |
+(function() { |
+ |
+t = async_test('callback is called even if the element is moved to foreign document'); |
+var callbackInvoked = false; |
+ |
+withFrame(t.step_func(function(originalFrame) { |
+ withFrame(function(destinationFrame) { |
+ var protoA = Object.create(originalFrame.contentWindow.HTMLElement.prototype); |
+ protoA.createdCallback = function() { |
+ var toBeMoved = originalFrame.contentDocument.getElementById('toBeMoved'); |
+ destinationFrame.contentDocument.body.appendChild(toBeMoved); |
+ }; |
+ |
+ var protoB = Object.create(originalFrame.contentWindow.HTMLElement.prototype); |
+ protoB.createdCallback = function() { |
+ callbackInvoked = true; |
+ }; |
+ |
+ originalFrame.contentDocument.registerElement('x-a', {prototype: protoA}); |
+ originalFrame.contentDocument.registerElement('x-b', {prototype: protoB}); |
+ originalFrame.contentDocument.body.innerHTML = '<x-a></x-a><x-b id="toBeMoved"></x-b>'; |
+ assert_true(callbackInvoked); |
+ |
+ t.done(); |
+ }); |
+})); |
+ |
+})(); |
</script> |