OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Custom Built-in Elements: define algorithm paths that are reached by cust
omized built-in elements</title> |
| 3 <link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#cus
tomelementsregistry"> |
| 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="resources/custom-elements-helpers.js"></script> |
| 7 <body> |
| 8 <script> |
| 9 |
| 10 'use strict'; |
| 11 |
| 12 test_with_window((w) => { |
| 13 class A extends w.HTMLButtonElement {} |
| 14 let valid_custom_element_names = [ |
| 15 'a-a', |
| 16 'z0-y0', |
| 17 'emotion-\u1f60d', |
| 18 'math-\u03b1', |
| 19 'a.b-c' |
| 20 ]; |
| 21 valid_custom_element_names.forEach((val) => { |
| 22 assert_throws_dom_exception(w, 'NotSupportedError', () => { |
| 23 w.customElements.define('a-a', A, { extends: val }); |
| 24 }, `having valid custon element name element interface (${val}) ` + |
| 25 'for extends should throw a NotSupportedError') |
| 26 }); |
| 27 }, 'Element interface for extends is not valid custom element name'); |
| 28 |
| 29 test_with_window((w) => { |
| 30 class A extends w.HTMLButtonElement {} |
| 31 let HTMLUnknownElement_names = [ |
| 32 'bgsound', |
| 33 'blink', |
| 34 'isindex', |
| 35 'multicol', |
| 36 'nextid', |
| 37 'spacer', |
| 38 42 |
| 39 ] |
| 40 HTMLUnknownElement_names.forEach((val) => { |
| 41 assert_throws_dom_exception(w, 'NotSupportedError', () => { |
| 42 w.customElements.define('a-a', A, { extends: val }); |
| 43 }, `having element interface for extends (${val}) undefined in specs` + |
| 44 ' should throw a NotSupportedError'); |
| 45 }); |
| 46 }, 'Element interface for extends defined in specification'); |
| 47 |
| 48 test_with_window((w) => { |
| 49 class A extends w.HTMLButtonElement {} |
| 50 w.customElements.define('defined-name', A, { extends: 'button' }); |
| 51 assert_equals(new A().localName, 'button', |
| 52 'localName should be element interface for extends'); |
| 53 assert_not_equals(new A().localName, 'defined-name', |
| 54 'localName should not be defined-name'); |
| 55 }, 'localName set to element interface for extends'); |
| 56 </script> |
| 57 </body> |
OLD | NEW |