| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Custom Elements: CEReactions on Document interface</title> | 4 <title>Custom Elements: CEReactions on Document 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 <meta name="help" content="https://html.spec.whatwg.org/#document"> | 8 <meta name="help" content="https://html.spec.whatwg.org/#document"> |
| 9 <script src="/resources/testharness.js"></script> | 9 <script src="/resources/testharness.js"></script> |
| 10 <script src="/resources/testharnessreport.js"></script> | 10 <script src="/resources/testharnessreport.js"></script> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const body = contentDocument.createElement('body'); | 103 const body = contentDocument.createElement('body'); |
| 104 body.appendChild(instance); | 104 body.appendChild(instance); |
| 105 | 105 |
| 106 assert_array_equals(element.takeLog().types(), ['constructed']); | 106 assert_array_equals(element.takeLog().types(), ['constructed']); |
| 107 assert_equals(body.innerHTML, '<custom-element></custom-element>'); | 107 assert_equals(body.innerHTML, '<custom-element></custom-element>'); |
| 108 | 108 |
| 109 contentDocument.body = body; | 109 contentDocument.body = body; |
| 110 assert_array_equals(element.takeLog().types(), ['connected']); | 110 assert_array_equals(element.takeLog().types(), ['connected']); |
| 111 }, 'body on Document must enqueue connectedCallback when inserting a custom elem
ent'); | 111 }, 'body on Document must enqueue connectedCallback when inserting a custom elem
ent'); |
| 112 | 112 |
| 113 test_with_window(function (contentWindow, contentDocument) { |
| 114 const element = define_custom_element_in_window(contentWindow, 'custom-eleme
nt', []); |
| 115 contentDocument.body.innerHTML = '<custom-element></custom-element>'; |
| 116 assert_array_equals(element.takeLog().types(), ['constructed', 'connected'])
; |
| 117 |
| 118 contentDocument.open(); |
| 119 assert_array_equals(element.takeLog().types(), ['disconnected']); |
| 120 }, 'open on Document must enqueue disconnectedCallback when removing a custom el
ement'); |
| 121 |
| 122 test_with_window(function (contentWindow, contentDocument) { |
| 123 const element = define_custom_element_in_window(contentWindow, 'custom-eleme
nt', []); |
| 124 contentDocument.body.innerHTML = '<custom-element></custom-element>'; |
| 125 assert_array_equals(element.takeLog().types(), ['constructed', 'connected'])
; |
| 126 |
| 127 contentDocument.write(''); |
| 128 assert_array_equals(element.takeLog().types(), ['disconnected']); |
| 129 }, 'write on Document must enqueue disconnectedCallback when removing a custom e
lement'); |
| 130 |
| 131 test_with_window(function (contentWindow, contentDocument) { |
| 132 const element = define_custom_element_in_window(contentWindow, 'custom-eleme
nt', []); |
| 133 contentWindow.document.write('<custom-element></custom-element>'); |
| 134 assert_array_equals(element.takeLog().types(), ['constructed', 'connected'])
; |
| 135 }, 'write on Document must enqueue connectedCallback after constructing a custom
element'); |
| 136 |
| 137 test_with_window(function (contentWindow, contentDocument) { |
| 138 const element = define_custom_element_in_window(contentWindow, 'custom-eleme
nt', []); |
| 139 contentDocument.body.innerHTML = '<custom-element></custom-element>'; |
| 140 assert_array_equals(element.takeLog().types(), ['constructed', 'connected'])
; |
| 141 |
| 142 contentDocument.writeln(''); |
| 143 assert_array_equals(element.takeLog().types(), ['disconnected']); |
| 144 }, 'writeln on Document must enqueue disconnectedCallback when removing a custom
element'); |
| 145 |
| 146 test_with_window(function (contentWindow) { |
| 147 const element = define_custom_element_in_window(contentWindow, 'custom-eleme
nt', []); |
| 148 contentWindow.document.writeln('<custom-element></custom-element>'); |
| 149 assert_array_equals(element.takeLog().types(), ['constructed', 'connected'])
; |
| 150 }, 'writeln on Document must enqueue connectedCallback after constructing a cust
om element'); |
| 151 |
| 113 </script> | 152 </script> |
| 114 </body> | 153 </body> |
| 115 </html> | 154 </html> |
| OLD | NEW |