Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Components - why <content> was replaced with <slot>

Tags:

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.

like image 772
Tomasz Pluskiewicz Avatar asked Jul 23 '16 09:07

Tomasz Pluskiewicz


1 Answers

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

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

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.

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.

See also here for other changes between v0 and v1:

like image 186
Hayato Ito Avatar answered Sep 28 '22 02:09

Hayato Ito