OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
3 <script src="testutils.js"></script> | 3 <script src="testutils.js"></script> |
4 <body> | 4 <body> |
5 <script> | 5 <script> |
6 description('Tests that an element is not upgraded after being moved to ' + | 6 description('Tests that an element is not upgraded after being moved to ' + |
7 'a different document, then destroyed'); | 7 'a different document, then destroyed'); |
8 | 8 |
9 jsTestIsAsync = true; | 9 jsTestIsAsync = true; |
10 | 10 |
11 withFrame(function (frame) { | 11 withFrame(function (frame) { |
12 // Create an upgrade candidate. Don't wrap it. | 12 // Create an upgrade candidate. Don't wrap it. |
13 var div = document.createElement('div'); | 13 var div = document.createElement('div'); |
14 div.innerHTML = '<span is="x-a"></span>'; | 14 div.innerHTML = '<span is="x-a"></span>'; |
15 | 15 |
16 // Move the upgrade candidate to a different document. | 16 // Move the upgrade candidate to a different document. |
17 frame.contentDocument.body.appendChild(div); | 17 frame.contentDocument.body.appendChild(div); |
18 | 18 |
19 // Delete the upgrade candidate. | 19 // Delete the upgrade candidate. |
20 div.innerHTML = ''; | 20 div.innerHTML = ''; |
21 | 21 |
22 // Provide a definition that would have matched. | 22 // Provide a definition that would have matched. |
23 var proto = Object.create(HTMLSpanElement.prototype); | 23 var proto = Object.create(HTMLSpanElement.prototype); |
24 proto.createdCallback = function () { | 24 proto.createdCallback = function () { |
25 testFailed('unreachable'); | 25 testFailed('unreachable'); |
26 }; | 26 }; |
27 document.register('x-a', {prototype: proto}); | 27 document.registerElement('x-a', {prototype: proto}); |
28 | 28 |
29 testPassed('Did not crash.'); | 29 testPassed('Did not crash.'); |
30 | 30 |
31 frame.remove(); | 31 frame.remove(); |
32 finishJSTest(); | 32 finishJSTest(); |
33 }); | 33 }); |
34 | 34 |
35 successfullyParsed = true; | 35 successfullyParsed = true; |
36 </script> | 36 </script> |
OLD | NEW |