OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Custom Elements: Custom Element State "Failed" in document parser</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="resources/custom-elements-helpers.js"></script> |
| 6 <body> |
| 7 <template id="test-content"> |
| 8 <script> |
| 9 'use strict'; |
| 10 window.logs = []; |
| 11 customElements.define('a-a', class extends HTMLElement { |
| 12 constructor() { |
| 13 super(); |
| 14 logs.push('constructor'); |
| 15 throw new Error(); |
| 16 } |
| 17 connectedCallback() { |
| 18 logs.push('connected'); |
| 19 } |
| 20 }); |
| 21 </script> |
| 22 <a-a></a-a> |
| 23 </template> |
| 24 <script> |
| 25 'use strict'; |
| 26 |
| 27 // 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" |
| 30 // https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-
token |
| 31 |
| 32 // 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 |
| 34 // used only in document parser. |
| 35 |
| 36 test_with_window(w => { |
| 37 let logs = w.logs; |
| 38 assert_equals(logs.length, 1, 'Only constructor should be invoked'); |
| 39 assert_equals(logs[0], 'constructor', 'The 1st action should be constructor'); |
| 40 }, undefined, document.getElementById('test-content').innerHTML); |
| 41 </script> |
| 42 </body> |
OLD | NEW |