forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1877025 - Make declarative shadow roots of custom elements availa…
…ble to element internals. r=peterv,dom-core Differential Revision: https://phabricator.services.mozilla.com/D200177
- Loading branch information
1 parent
33b8a28
commit 8765190
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...m/tests/shadow-dom/declarative/declarative-shadow-dom-available-to-element-internals.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Declarative Shadow DOM</title> | ||
<link rel="author" href="mailto:[email protected]"> | ||
<link rel="help" href="https://html.spec.whatwg.org/#parsing-main-inhead:available-to-element-internals"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<custom-element> | ||
<template shadowrootmode="open"> | ||
</template> | ||
</custom-element> | ||
|
||
<script> | ||
let internals; | ||
customElements.define("custom-element", class extends HTMLElement { | ||
constructor() { | ||
super(); | ||
internals = this.attachInternals(); | ||
} | ||
}); | ||
|
||
window.onload = () => { | ||
test(() => { | ||
assert_true(!!internals); | ||
assert_true(!!internals.shadowRoot); | ||
assert_equals(internals.shadowRoot, document.querySelector("custom-element").shadowRoot); | ||
}, "Declarative Shadow DOM: shadow root should be available to element internals"); | ||
}; | ||
</script> |