|
53 | 53 | }, 'importNode should clone using the global regsitry by default');
|
54 | 54 |
|
55 | 55 | test(() => {
|
56 |
| - assert_true(document.importNode(document.createElement('some-element'), {customElementRegistry: scopedRegistry}) instanceof ScopedSomeElement); |
57 |
| -}, 'importNode should clone using the specified scoped regsitry'); |
| 56 | + assert_true(document.importNode(document.createElement('some-element'), {customElementRegistry: scopedRegistry}) instanceof GlobalSomeElement); |
| 57 | +}, 'importNode should clone using target\'s registry if non-null'); |
| 58 | + |
| 59 | +test(() => { |
| 60 | + assert_true(document.importNode(document.implementation.createHTMLDocument().createElement('some-element'), {customElementRegistry: scopedRegistry}) instanceof ScopedSomeElement); |
| 61 | +}, 'importNode should clone using the specified registry if target\'s registry is null'); |
58 | 62 |
|
59 | 63 | test(() => {
|
60 | 64 | const clone = document.importNode(host, {selfOnly: false, customElementRegistry: scopedRegistry});
|
|
83 | 87 | const element = document.createElement('div', {customElementRegistry: emptyRegistry});
|
84 | 88 | element.innerHTML = '<some-element></some-element><other-element></other-element>';
|
85 | 89 | const clone = document.importNode(element, {selfOnly: false, customElementRegistry: scopedRegistry});
|
86 |
| - assert_equals(clone.customElementRegistry, scopedRegistry); |
87 |
| - assert_true(clone.querySelector('some-element') instanceof ScopedSomeElement); |
| 90 | + assert_equals(clone.customElementRegistry, emptyRegistry); |
| 91 | + assert_true(clone.querySelector('some-element') instanceof HTMLElement); |
| 92 | + assert_false(clone.querySelector('some-element') instanceof GlobalSomeElement); |
| 93 | + assert_false(clone.querySelector('some-element') instanceof ScopedSomeElement); |
| 94 | + assert_true(clone.querySelector('other-element') instanceof HTMLElement); |
88 | 95 | assert_false(clone.querySelector('other-element') instanceof GlobalOtherElement);
|
89 |
| -}, 'importNode should clone an element originating from a scoped registry using another scoped registry'); |
| 96 | +}, 'importNode should clone using target\'s registry if non-null, including when it\'s not the global registry'); |
90 | 97 |
|
91 | 98 | test(() => {
|
92 | 99 | const template = document.createElement('template');
|
|
0 commit comments