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> | |
11 <script src="./resources/reactions.js"></script> | 10 <script src="./resources/reactions.js"></script> |
12 </head> | 11 </head> |
13 <body> | 12 <body> |
14 <div id="log"></div> | 13 <div id="log"></div> |
15 <script> | 14 <script> |
16 | 15 |
17 test(function () { | 16 test(function () { |
18 var element = define_new_custom_element(); | 17 var element = defineNewCustomElement(); |
19 var instance = document.createElement(element.name); | 18 var instance = document.createElement(element.name); |
20 assert_array_equals(element.takeLog().types(), ['constructed']); | 19 assert_array_equals(element.log().types(), ['constructed']); |
21 | 20 |
22 var newDoc = document.implementation.createHTMLDocument(); | 21 var newDoc = document.implementation.createHTMLDocument(); |
23 newDoc.importNode(instance); | 22 newDoc.importNode(instance); |
24 | 23 |
25 var logEntries = element.takeLog(); | 24 var logEntries = element.log(); |
26 assert_array_equals(logEntries.types(), ['constructed']); | 25 assert_array_equals(logEntries.types(), ['constructed']); |
27 assert_equals(logEntries.last().oldDocument, document); | 26 assert_equals(logEntries.log().oldDocument, document); |
28 assert_equals(logEntries.last().newDocument, newDoc); | 27 assert_equals(logEntries.log().newDocument, newDoc); |
29 }, 'importNode on Document must construct a new custom element when importing a
custom element'); | 28 }, 'importNode on Document must construct a new custom element when importing a
custom element'); |
30 | 29 |
31 test(function () { | 30 test(function () { |
32 var element = define_new_custom_element(); | 31 var element = defineNewCustomElement(); |
33 var instance = document.createElement(element.name); | 32 var instance = document.createElement(element.name); |
34 assert_array_equals(element.takeLog().types(), ['constructed']); | 33 assert_array_equals(element.log().types(), ['constructed']); |
35 | 34 |
36 var newDoc = document.implementation.createHTMLDocument(); | 35 var newDoc = document.implementation.createHTMLDocument(); |
37 newDoc.adoptNode(instance); | 36 newDoc.adoptNode(instance); |
38 | 37 |
39 var logEntries = element.takeLog(); | 38 var logEntries = element.log(); |
40 assert_array_equals(logEntries.types(), ['adopted']); | 39 assert_array_equals(logEntries.types(), ['adopted']); |
41 assert_equals(logEntries.last().oldDocument, document); | 40 assert_equals(logEntries.log().oldDocument, document); |
42 assert_equals(logEntries.last().newDocument, newDoc); | 41 assert_equals(logEntries.log().newDocument, newDoc); |
43 }, 'adoptNode on Document must enqueue an adopted reaction when importing a cust
om element'); | 42 }, 'adoptNode on Document must enqueue an adopted reaction when importing a cust
om element'); |
44 | 43 |
45 </script> | 44 </script> |
46 </body> | 45 </body> |
47 </html> | 46 </html> |
OLD | NEW |