更新时间:2023-11-20 15:11:46
据我了解,getElementById将搜索影子根,但显然不会。
It was my understanding that getElementById will search through the shadow roots but apparently not.
文档
上的任何查询方法都不会搜索影子根,这是使它们成为 shadowy 的一部分。
None of the query methods on document
will search through shadow roots, this is part of what makes them shadowy.
此规则的一个例外是,如果您使用 querySelector [All]
以及专门刺穿阴影根的选择器,即使用 / deep /
或 :: shadow
)。
An exception to this rule is if you use querySelector[All]
and a selector that specifically pierces shadow-roots, i.e. uses /deep/
or ::shadow
).