-
Notifications
You must be signed in to change notification settings - Fork 155
Added a flag to selectively use shadow dom #1101
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
Conversation
Users can use the Shadow DOM instead of the original, through the `data-shadow-root` property of the base element. `data-shadow-dom` attribute should be `open` or `closed`, or implicitly use `open` when it is empty. When Shadow DOM is enabled, it can protect the host styles by isolating style changes that occur inside the Worker. Uses of `<link>` for external stylesheets inside the Worker are also isolated, so they also need to be moved inside the base element. Resolves ampproject#1093
This looks amazing! I'll give it a proper review this week. |
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.
One small comment. Otherwise the only thing this is missing is unit tests. Looks great
Co-authored-by: Jake Fried <samouri@users.noreply.github.com>
Added a very simple one |
Resolves #1093
Users can use the Shadow DOM instead of the original, through the
data-shadow-dom
property of the base element.data-shadow-dom
attribute should beopen
orclosed
When Shadow DOM is enabled, it can protect the host styles by isolating style changes that occur inside the Worker.
Uses of
<link>
for external stylesheets inside the Worker are also isolated, so they also need to be moved inside the base element.Note:
Using shadow dom may have side effects. I leave some issue I found here.
In the React example, event listeners don't work at all. I'm guessing it's a React bug since there's no problem in the same Preact example.
Shadow DOM is known to have very little performance penalty, but in high-load apps like DBMon seem to have frame drops quite noticiable actually.
