mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1633094 [wpt PR 23249] - Fix a null reference in declarative shadow dom, a=testonly
Automatic update from web-platform-tests Fix a null reference in declarative shadow dom Previously, this would cause a null-reference: <template shadowroot=open>Content</template> This is now fixed. In addition, this CL adds two more tests of declarative shadow dom, for the two conditions listed at [1] and [2]. The [2] condition test also tests this CL. [1] https://github.com/mfreed7/declarative-shadow-dom/blob/master/README.md#root-element-is-template-shadowroot [3] https://github.com/mfreed7/declarative-shadow-dom/blob/master/README.md#templates-containing-root-level-declarative-shadow-roots Bug: 1042130 Change-Id: Id697fb3f89681981ca3ecc513451d0644430fd2b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2166357 Commit-Queue: Kouhei Ueno <kouhei@chromium.org> Auto-Submit: Mason Freed <masonfreed@chromium.org> Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Cr-Commit-Position: refs/heads/master@{#762842} -- wpt-commits: 9b7ab1c11b7e0cf9b43ea6dbb282c33e4d193726 wpt-pr: 23249
This commit is contained in:
parent
e80056ab91
commit
44b66a789a
@ -113,6 +113,16 @@ test(() => {
|
||||
assert_true(!!host.shadowRoot,"No shadow root found");
|
||||
assert_false(host.shadowRoot.delegatesFocus,"delegatesFocus should be false without the shadowrootdelegatesfocus attribute");
|
||||
}, 'Declarative Shadow DOM: delegates focus attribute');
|
||||
|
||||
test(() => {
|
||||
const host = document.createElement('div');
|
||||
// Root element of innerHTML is a <template shadowroot>:
|
||||
host.innerHTML = '<template shadowroot=open></template>';
|
||||
assert_equals(host.shadowRoot, null, "Shadow root should not be present");
|
||||
const tmpl = host.querySelector('template');
|
||||
assert_true(!!tmpl,"Template should still be present");
|
||||
assert_equals(tmpl.getAttribute('shadowroot'),"open","'shadowroot' attribute should still be present");
|
||||
}, 'Declarative Shadow DOM: innerHTML root element');
|
||||
</script>
|
||||
|
||||
<div id="multi-host">
|
||||
@ -123,7 +133,6 @@ test(() => {
|
||||
<span>root 2</span>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
test(() => {
|
||||
const host = document.querySelector('#multi-host');
|
||||
@ -134,3 +143,19 @@ test(() => {
|
||||
}, 'Declarative Shadow DOM: Multiple roots');
|
||||
|
||||
</script>
|
||||
|
||||
<template id="root-element-shadow">
|
||||
<template shadowroot=open>Content</template>
|
||||
</template>
|
||||
<script>
|
||||
test(() => {
|
||||
// Root element of this template is a <template shadowroot>:
|
||||
const template = document.querySelector('#root-element-shadow');
|
||||
const host = document.createElement('div');
|
||||
host.appendChild(template.content.cloneNode(true));
|
||||
assert_equals(host.shadowRoot, null, "Shadow root should not be present");
|
||||
const tmpl = host.querySelector('template');
|
||||
assert_true(!!tmpl,"Template should still be present");
|
||||
assert_equals(tmpl.getAttribute('shadowroot'),"open","'shadowroot' attribute should still be present");
|
||||
}, 'Declarative Shadow DOM: template root element');
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user