| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Custom Elements: defineElement</title> | 2 <title>Custom Elements: defineElement</title> |
| 3 <link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#cus
tomelementsregistry"> | 3 <link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#cus
tomelementsregistry"> |
| 4 <meta name="author" title="Dominic Cooney" href="mailto:dominicc@chromium.org"> | 4 <meta name="author" title="Dominic Cooney" href="mailto:dominicc@chromium.org"> |
| 5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="resources/custom-elements-helpers.js"></script> | 7 <script src="resources/custom-elements-helpers.js"></script> |
| 8 <body> | 8 <body> |
| 9 <script> | 9 <script> |
| 10 // TODO(dominicc): Merge these tests with | 10 // TODO(dominicc): Merge these tests with |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // attributeChangedCallback is undefined. | 403 // attributeChangedCallback is undefined. |
| 404 test_with_window((w) => { | 404 test_with_window((w) => { |
| 405 let observedAttributes_invoked = false; | 405 let observedAttributes_invoked = false; |
| 406 let X = (function () {}).bind({}); | 406 let X = (function () {}).bind({}); |
| 407 Object.defineProperty(X, 'observedAttributes', { | 407 Object.defineProperty(X, 'observedAttributes', { |
| 408 get() { observedAttributes_invoked = true; } | 408 get() { observedAttributes_invoked = true; } |
| 409 }); | 409 }); |
| 410 assert_false( observedAttributes_invoked, 'Get(constructor, observedAttributes
) should not be invoked'); | 410 assert_false( observedAttributes_invoked, 'Get(constructor, observedAttributes
) should not be invoked'); |
| 411 }, 'Get(constructor, observedAttributes) should not execute if ' + | 411 }, 'Get(constructor, observedAttributes) should not execute if ' + |
| 412 'attributeChangedCallback is undefined'); | 412 'attributeChangedCallback is undefined'); |
| 413 |
| 414 test_with_window((w) => { |
| 415 let attributes = {}; |
| 416 attributes[Symbol.iterator] = function*() { |
| 417 throw new TypeError(); |
| 418 }; |
| 419 class X extends w.HTMLElement { |
| 420 constructor() { super(); } |
| 421 attributeChangedCallback() {} |
| 422 static get observedAttributes() { |
| 423 return attributes; |
| 424 } |
| 425 } |
| 426 assert_throws(TypeError.prototype, () => { |
| 427 w.customElements.define('x-x', X); |
| 428 }); |
| 429 }, 'Throwing an exception in observedAttributes'); |
| 413 </script> | 430 </script> |
| 414 </body> | 431 </body> |
| OLD | NEW |