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