The two shadow-piercing combinators have been removed, as stated in https://www.chromestatus.com/features/6750456638341120
So, what's the substitute for achieving the same thing? Or has this shadow-piercing feature been completely abandoned?
The two shadow-piercing combinators have been removed, as stated in https://www.chromestatus.com/features/6750456638341120
So, what's the substitute for achieving the same thing? Or has this shadow-piercing feature been completely abandoned?
::shadow
and /deep/
were removed for breaking encapsulation.
The substitutes are:
:host-context
. Read here: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201/::shadow
–
Hostel ::shadow
and /deep/
break encapsulation. I am glad they are gone.". Although they break encapsulation, if you use 3rd party components and they don't have css variables to style the way you want, you are simple without options, except for asking them to create the variables you want (which could never be created), or having to fork the component and to maintain it yourself just because of some trivial css you could have applied if /deep/
was supported. I would prefer never have to use /deep/
, but I would want to be able to use it when needed. –
Monitory /deep/
was something good. In an ideal world, every library would provide every expected css variable so as to make the use of hacks such as /deep/
unecessary. Unfortunately, they are people with limited resources and time, and it's expected that their components will have css properties that the consumers can't override through css because of the shadow DOM. Such problems would be greatly mitigated with /deep/
. –
Monitory As of Polymer 2:
::shadow
(shadow-piercing selectors) - there is no direct substitute. Instead a custom CSS properties has to be used. Polymer 2: Custom CSS Properties
/deep/
- there is some sort of replacement by defining :host > * { ... }
(applies a ruleset to all of the top-level children in the host's shadow tree, which doesn't conflict with the rule in the main document).
For more detailed information check Polymer 2 Upgrade Notes
At the time of writing you can try ::part
and ::theme
with Chrome 73 and above:
https://www.chromestatus.com/feature/5763933658939392
<submit-form>
#shadow-root
<x-form exportparts="some-input, some-box">
#shadow-root
<x-bar exportparts="some-input, some-box">
#shadow-root
<x-foo part="some-input, some-box"></x-foo>
</x-bar>
</x-form>
</submit-form>
<x-form></x-form>
<x-bar></x-bar>
You can style all the inputs with:
:root::part(some-input) { ... }
There is the full documentation how it works:
https://github.com/fergald/docs/blob/master/explainers/css-shadow-parts-1.md
This somehow can solve your problem, but I still miss the days how I styled embedded tweets with ::shadow
.
"::v-deep" is working for me. For example:
.menu {
// stuff
}
/deep/.sub-menu { // override submenu
.sub-menu__mini {
//stuff
}
a, a:hover {
//stuff
}
}
}
becomes:
.menu {
// stuff
}
::v-deep .sub-menu { // override submenu
.sub-menu__mini {
//stuff
}
a, a:hover {
//stuff
}
}
}
::ng-deep
–
Tyratyrannical © 2022 - 2024 — McMap. All rights reserved.
::shadow
anddeep
that works now, use astyle
element inside your shadow root, with something like@import url( '/common-style.css' )
. See #34699850 and #30829519 The longer-term solution is CSS Custom Properties (aka “CSS variables”). – Zohara