Web 组件 - 为什么是 <content>被替换为 <slot> [英] Web Components - why <content> was replaced with <slot>

查看:64
本文介绍了Web 组件 - 为什么是 <content>被替换为 <slot>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Shadow DOM 1.0 版将用 完全替换 标签.网上有一些例子,我找不到相关的讨论来证明这种变化是合理的.

Version 1.0 of Shadow DOM will completely replace the <content> tag with <slot>. There are examples on the web I cannot find a relevant discussion which justifies this change.

有什么问题, 将解决什么问题?毕竟新设计完全不同.

What was the problem with <content>, which <slot> will solve? After all the new design is completely different.

推荐答案

Shadow DOM 规范的编辑器在这里.

The editor of Shadow DOM specification is here.

这里很难总结原因,但是,以下讨论和会议记录可能有助于了解历史和原因:

It would be difficult to summarize the reason here, however, the following discussions and the minutes might be helpful to understand the history and the reason:

  • https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/thread.html#msg184
  • https://www.w3.org/wiki/Webapps/WebComponentsApril2015Meeting (See "F. Slots Proposal")
  • https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/thread.html#msg649

是的,Google 一开始反对这个改变,但我们别无选择让 Shadow DOM 向前发展.:)

Yeah, Google opposed to this change at first, but we had no other choice to make Shadow DOM forward. :)

我已将 Shadow DOM 规范重写为v1",以便它成为所有浏览器供应商都同意的标准.这是主要原因.

I have rewritten Shadow DOM specification as "v1" so that it will be the standard on which all browser vendors could agree. That's the primary reason.

我们都知道 API 更改对 Web 开发人员来说是痛苦的,但我相信每个浏览器中的原生 Shadow DOM"从长远来看对 Web 平台非常重要.

We all are aware that the API change is painful for Web developers, but I believed that "Native Shadow DOM in every browsers" is much important for the Web platform in the long term.

另请参阅此处了解 v0 和 v1 之间的其他更改:

See also here for other changes between v0 and v1:

这篇关于Web 组件 - 为什么是 &lt;content&gt;被替换为 &lt;slot&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆