Starting in Chrome 63, you cannot use the shadow-piercing selectors ::shadow
and /deep/
to style content inside of a shadow root.
- The
/deep/
combinator will act as a descendant selector.x-foo /deep/ div
will work likex-foo div
. - The
::shadow
pseudo-element will not match any elements.
The decision to remove
The ::shadow
and /deep/
were deprecated in Chrome version 45. This was
decided by all of the participants at the April 2015 Web Components meetup.
The primary concern with shadow-piercing selectors is that they violate encapsulation and create situations where a component can no longer change its internal implementation.
The CSS Shadow Parts spec is being advanced as an alternative to shadow piercing selectors. Shadow Parts will allow a component author to expose named elements in a way that preserves encapsulation and still allows page authors the ability to style multiple properties at once.
What should I do if my site uses ::shadow and /deep/?
The ::shadow
and /deep/
selectors only affect legacy Shadow DOM v0
components. If you're using Shadow DOM v1, you should not need to change
anything on your site.
You can use Chrome Canary
to verify your site does not break with these new changes. If you notice issues,
try and remove any usage of ::shadow
and /deep/
. If it's too difficult to
remove usage of these selectors, consider switching from native shadow DOM over
to the shady DOM polyfill. You should only need to make this change if your site
relies on native shadow DOM v0.