期间Web Applications WG (WebApps) Web Components meeting in Mountain View CA US on Friday 24 April 2015 ,得出的结论是应该删除支持多个影子根。据我了解,插槽应该用作使用多个影子根的替代方案。然而, session 记录中提供的解释为什么使用插槽更好的原因的链接已被删除,我找不到任何其他文档来说明如何以及为何做出此决定。我怀疑这与处理多个影子根的困惑性质有关,但我不确定。如果能解释为什么删除多个影子根的支持,我将不胜感激。
TLDR;给出了取消对多个影子根的支持并要求使用插槽的原因。
最佳答案
这是因为它实现起来很复杂。
来自 W3C Web Components wiki :
Pros: enables consistent story for adding shadow trees to builtins / provides reasoning about subclassing DOM trees
Cons: complexity / performance: may result in "submerged" trees that aren't rendered but still participate in style/layout
Cost/benefit of change: Disables the use case for general inheritance-based component composition and Firefox UI in XBL) / Makes implementing Shadow DOM easier
关于dom - 为什么删除了对多个影子根的支持并用槽代替,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45196663/