Closed ameshkov closed 4 years ago
They attach a closed shadow root, which is introduced in Shadow DOM version 1, and is by specification invisible to third-party scripts.
In such cases, even using querySelectorAll
with /deep/
combinator does not return matched nodes in the shadow dom. There are several measures taken for other apis in order to un-expose presence of closed shadow dom, such as element.shadowRoot
returning null
, and Event.composedPath()
not returning nodes in closed shadow dom.
We can wrap Element.prototype.attachShadow
to keep track of shadow roots internally, and use this information for matching selectors. For this purpose, syntaxes like .row:shadow(> iframe[src^="data:html"]
will be straightforward to implement. The standard >>>
combinator does not play nicely with sizzle's api, we will need to modify significant portion of it.
Shadow DOM piercing implementation: https://codereview.adblockplus.org/29559743/
Yandex uses a complicated ads reinjection on the main page, we need to support
/deep/
to handle it: https://www.yandex.ru/