-
Notifications
You must be signed in to change notification settings - Fork 1k
[@lit-labs/ssr] Implement HTMLElement.shadowRoot #2662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aomarks
merged 7 commits into
lit:main
from
nicholasrice:users/nicholasrice/add-shadowRoot-to-htmlelement
Mar 25, 2022
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1ed201c
implement HTMLElement.shadowRoot property into dom-shim
nicholasrice 963f14c
add tests for HTMLElement.shadowRoot property
nicholasrice b11ef3e
add chageset
nicholasrice a3d8cc7
Update packages/labs/ssr/src/test/lib/dom-shim_test.ts
nicholasrice 5295866
Update packages/labs/ssr/src/test/lib/dom-shim_test.ts
nicholasrice 4ae563e
rename private shadowRoot field to _shadowRoot
nicholasrice 7f2e51a
require shadowRootInit argument to attachShadow to align with platfor…
nicholasrice File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| '@lit-labs/ssr': minor | ||
| --- | ||
|
|
||
| Adds HTMLElement.shadowRoot property to dom-shim. |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,33 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2022 Google LLC | ||
| * SPDX-License-Identifier: BSD-3-Clause | ||
| */ | ||
|
|
||
| import {getWindow} from '../../lib/dom-shim.js'; | ||
| import {test} from 'uvu'; | ||
| import * as assert from 'uvu/assert'; | ||
|
|
||
| const window = getWindow({}) as unknown as Window; | ||
| const {HTMLElement} = window.window; | ||
|
|
||
| test('elements without an attached shadow root should expose a null value from the "shadowRoot" property', () => { | ||
| class UnattachedShadowRoot extends HTMLElement {} | ||
| const element = new UnattachedShadowRoot(); | ||
| assert.is(element.shadowRoot, null); | ||
| }); | ||
| test('elements defined with an open shadow root should expose it\'s shadow root from the "shadowRoot" property', () => { | ||
| class OpenShadowRoot extends HTMLElement {} | ||
| const element = new OpenShadowRoot(); | ||
| const shadow = element.attachShadow({mode: 'open'}); | ||
| assert.is(shadow, element.shadowRoot); | ||
| assert.is(shadow.host, element); | ||
| }); | ||
| test('elements defined with a closed shadow root should expose a null value from the "shadowRoot" property', () => { | ||
| class ClosedShadowRoot extends HTMLElement {} | ||
| const element = new ClosedShadowRoot(); | ||
| element.attachShadow({mode: 'closed'}); | ||
| assert.is(element.shadowRoot, null); | ||
| }); | ||
|
|
||
| test.run(); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.