| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Custom Elements: Custom Element State "Failed" in document parser</title> | 2 <title>Custom Elements: Custom Element State "Failed" in document parser</title> |
| 3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="resources/custom-elements-helpers.js"></script> | 5 <script src="resources/custom-elements-helpers.js"></script> |
| 6 <body> | 6 <body> |
| 7 <template id="test-content"> | 7 <template id="test-content"> |
| 8 <script> | 8 <script> |
| 9 'use strict'; | 9 'use strict'; |
| 10 window.logs = []; | 10 window.logs = []; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 </script> | 21 </script> |
| 22 <a-a></a-a> | 22 <a-a></a-a> |
| 23 </template> | 23 </template> |
| 24 <script> | 24 <script> |
| 25 'use strict'; | 25 'use strict'; |
| 26 | 26 |
| 27 // Custom Element State | 27 // Custom Element State |
| 28 // https://dom.spec.whatwg.org/#concept-element-custom-element-state | 28 // https://dom.spec.whatwg.org/#concept-element-custom-element-state |
| 29 // Set to "failed" in step 7 of "create an element for a token" | 29 // Set to "failed" in step 7 of "create an element for a token" |
| 30 // https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-
token | 30 // https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-
token |
| 31 // If this step throws an exception, then report the exception, and let element
be |
| 32 // instead a new element that implements HTMLUnknownElement, with no attributes, |
| 33 // namespace set to given namespace, namespace prefix set to null, custom elemen
t state |
| 34 // set to "failed", custom element definition set to null, and node document set
to document. |
| 31 | 35 |
| 32 // This test loads the template content into iframe.srcdoc because "create an | 36 // This test loads the template content into iframe.srcdoc because "create an |
| 33 // element for a token" with synchronous custom elements flag set to true is | 37 // element for a token" with synchronous custom elements flag set to true is |
| 34 // used only in document parser. | 38 // used only in document parser. |
| 35 | 39 |
| 36 test_with_window(w => { | 40 test_with_window(w => { |
| 37 let logs = w.logs; | 41 let logs = w.logs; |
| 38 assert_equals(logs.length, 1, 'Only constructor should be invoked'); | 42 assert_equals(logs.length, 1, 'Only constructor should be invoked'); |
| 39 assert_equals(logs[0], 'constructor', 'The 1st action should be constructor'); | 43 assert_equals(logs[0], 'constructor', 'The 1st action should be constructor'); |
| 44 let e = w.document.querySelector('a-a'); |
| 45 assert_equals(Object.getPrototypeOf(e), w.HTMLUnknownElement.prototype); |
| 40 }, undefined, document.getElementById('test-content').innerHTML); | 46 }, undefined, document.getElementById('test-content').innerHTML); |
| 41 </script> | 47 </script> |
| 42 </body> | 48 </body> |
| OLD | NEW |