|
18 | 18 | assert_equals(element.customElementRegistry, null); |
19 | 19 | registry.initialize(element); |
20 | 20 | assert_equals(element.customElementRegistry, registry); |
21 | | - }, `${title}: customElementRegistry.prototype.initialize should upgrade the element given to the first argument`); |
| 21 | + }, `${title}: CustomElementRegistry.prototype.initialize should upgrade the element given to the first argument`); |
22 | 22 |
|
23 | 23 | test(() => { |
24 | 24 | const doc = makeDocument(); |
|
49 | 49 | assert_equals(registryInConstructor.length, 2); |
50 | 50 | assert_equals(registryInConstructor[0], registry); |
51 | 51 | assert_equals(registryInConstructor[1], registry); |
52 | | - }, `${title}: customElementRegistry.prototype.initialize should upgrade elements in tree order`); |
| 52 | + }, `${title}: CustomElementRegistry.prototype.initialize should upgrade elements in tree order`); |
53 | 53 |
|
54 | 54 | test(() => { |
55 | 55 | const doc1 = makeDocument(); |
|
78 | 78 | assert_true(undefinedElement1 instanceof ABElement); |
79 | 79 | assert_equals(undefinedElement2.customElementRegistry, registry2); |
80 | 80 | assert_equals(undefinedElement2.__proto__.constructor.name, 'HTMLElement'); |
81 | | - }, `${title}: customElementRegistry.prototype.initialize only upgrades elements beloning to the registry`); |
| 81 | + }, `${title}: CustomElementRegistry.prototype.initialize only upgrades elements beloning to the registry`); |
82 | 82 | } |
83 | 83 |
|
84 | 84 | runTest('Document', () => new Document); |
85 | 85 | runTest('HTMLDocument', () => document.implementation.createHTMLDocument()); |
86 | 86 | runTest('XHTMLDocument', () => document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null)); |
87 | 87 |
|
| 88 | +test(() => { |
| 89 | + class ABElement extends HTMLElement { }; |
| 90 | + const registry = new CustomElementRegistry; |
| 91 | + |
| 92 | + const element = document.createElement('a-b', { customElementRegistry: registry }); |
| 93 | + assert_equals(element.customElementRegistry, registry); |
| 94 | + assert_equals(element.__proto__.constructor.name, 'HTMLElement'); |
| 95 | + assert_false(element instanceof ABElement); |
| 96 | + |
| 97 | + registry.define('a-b', ABElement); |
| 98 | + assert_equals(element.customElementRegistry, registry); |
| 99 | + assert_equals(element.__proto__.constructor.name, 'HTMLElement'); |
| 100 | + assert_false(element instanceof ABElement); |
| 101 | + |
| 102 | + registry.initialize(element); |
| 103 | + assert_equals(element.customElementRegistry, registry); |
| 104 | + assert_equals(element.__proto__.constructor.name, 'ABElement'); |
| 105 | + assert_true(element instanceof ABElement); |
| 106 | +}, `CustomElementRegistry.prototype.initialize upgrades already initialized elements`); |
| 107 | + |
88 | 108 | </script> |
89 | 109 | </body> |
90 | 110 | </html> |
0 commit comments