OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Custom Elements: CEReactions on ParentNode interface</title> |
| 5 <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org"> |
| 6 <meta name="assert" content="importNode and adoptNode of Document interface must
have CEReactions"> |
| 7 <meta name="help" content="https://dom.spec.whatwg.org/#document"> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 <script src="./resources/reactions.js"></script> |
| 11 </head> |
| 12 <body> |
| 13 <div id="log"></div> |
| 14 <script> |
| 15 |
| 16 test(function () { |
| 17 var element = defineNewCustomElement(); |
| 18 var instance = document.createElement(element.name); |
| 19 assert_array_equals(element.log().types(), ['constructed']); |
| 20 |
| 21 var newDoc = document.implementation.createHTMLDocument(); |
| 22 newDoc.importNode(instance); |
| 23 |
| 24 var logEntries = element.log(); |
| 25 assert_array_equals(logEntries.types(), ['constructed']); |
| 26 assert_equals(logEntries.log().oldDocument, document); |
| 27 assert_equals(logEntries.log().newDocument, newDoc); |
| 28 }, 'importNode on Document must construct a new custom element when importing a
custom element'); |
| 29 |
| 30 test(function () { |
| 31 var element = defineNewCustomElement(); |
| 32 var instance = document.createElement(element.name); |
| 33 assert_array_equals(element.log().types(), ['constructed']); |
| 34 |
| 35 var newDoc = document.implementation.createHTMLDocument(); |
| 36 newDoc.adoptNode(instance); |
| 37 |
| 38 var logEntries = element.log(); |
| 39 assert_array_equals(logEntries.types(), ['adopted']); |
| 40 assert_equals(logEntries.log().oldDocument, document); |
| 41 assert_equals(logEntries.log().newDocument, newDoc); |
| 42 }, 'adoptNode on Document must enqueue an adopted reaction when importing a cust
om element'); |
| 43 |
| 44 </script> |
| 45 </body> |
| 46 </html> |
OLD | NEW |