- Notifications
You must be signed in to change notification settings - Fork421
feat: add support for ElementInternals in synthetic shadow#5519
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
feat: add support for ElementInternals in synthetic shadow#5519
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for the contribution! Unfortunately we can't verify the commit author(s): roxanne.baker <r***@s***.com>. One possible solution is toadd that email to your GitHub account. Alternatively you canchange your commits to another email and force push the change. After getting your commits associated with your GitHub account,refresh the status of this Pull Request. |
33a6d1e
toe579965
Comparee579965
to31414f3
Comparepackages/@lwc/engine-core/src/framework/base-lightning-element.ts OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
...-karma/test/component/LightningElement.attachInternals/elementInternals/sanity/index.spec.jsShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
...est/component/LightningElement.attachInternals/elementInternals/formAssociated/index.spec.js OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
...est/component/LightningElement.attachInternals/elementInternals/formAssociated/index.spec.js OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Will Harney <62956339+wjhsf@users.noreply.github.com>
// Ensure the DOM is in a clean state | ||
document.body.replaceChildren(); | ||
document.head.replaceChildren(); | ||
window.__lwcResetGlobalStylesheets(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
without this the stylesheet was removed after the first test, but since it was cached it wouldn't get re-added - meaning that the styles were only actually present for the first test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
- In synthetic shadow, can a user do
HTMLElement.prototype.attachInternals.call(someComponent)
and get access to thereal shadow root (not synthetic)? Or do we already guard that? - IIRC we wanted this to be an internal-only feature because synthetic shadow is deprecated, right? I think we'll need a compiler flag. Lemme double check.
...est/component/LightningElement.attachInternals/elementInternals/formAssociated/index.spec.js OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
...est/component/LightningElement.attachInternals/elementInternals/formAssociated/index.spec.js OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…ement.attachInternals/elementInternals/formAssociated/index.spec.jsCo-authored-by: Will Harney <62956339+wjhsf@users.noreply.github.com>
…ement.attachInternals/elementInternals/formAssociated/index.spec.jsCo-authored-by: Will Harney <62956339+wjhsf@users.noreply.github.com>
|
Uh oh!
There was an error while loading.Please reload this page.
const__lwc_component_class_internal=_registerComponent(Test,{tmpl:_tmpl,sel:"lwc-test",apiVersion:9999999}); This is the current result of compiling an LWC component. In order to have a compile-time switch for synthetic element internals, we should add an additional property to the object, which should just reflect a boolean set in the compiler options. Because 99% of components will never set the flag, we can avoid unnecessarily increasing file sizes by only setting the property when the compiler flag is lwc/packages/@lwc/babel-plugin-component/src/component.ts Lines 86 to 92 inb6e43be
The flag should be an optional boolean set via lwc/packages/@lwc/engine-core/src/framework/component.ts Lines 23 to 27 inb6e43be
lwc/packages/@lwc/engine-core/src/framework/component.ts Lines 62 to 64 inb6e43be
|
Uh oh!
There was an error while loading.Please reload this page.
Details
Removes the existing error when attempting to use
attachInternals
in synthetic shadow and instead uses a Proxy in synthetic shadow to ensure that the shadow root returns as expected. Error message was also removed for FACE-related callback methods in synthetic shadow.Existing tests were updated to run in synthetic shadow and new tests added to cover functionality related to other
ElementInternals
properties not covered by existing tests.Does this pull request introduce a breaking change?
No, it does not introduce a breaking change.
Does this pull request introduce an observable change?
Yes, it does include an observable change.
ElementInternals/attachInternals and FACE callbacks should now be fully supported in synthetic shadow instead of throwing errors.
GUS work item
W-19275967