TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The Power of Web Components

170 点作者 lainon超过 6 年前

11 条评论

kyledrake超过 6 年前
This is a bit off topic, but I really wish the idea of including HTML imports (<a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;Web_Components&#x2F;HTML_Imports" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;Web_Components&#x2F;...</a>) was taken seriously. There&#x27;s a lot of people that just want to make a simple HTML site with templates for things like the navigation menu, without a bunch of nasty JavaScript goop that can&#x27;t be search indexed easily, and the ability to include simple templates using HTML would have been an huge resource for those people and for search engines.<p>I think it really shows how much of a bubble the web often lives in now. We used to be able to just make a solid web site with simple HTML and a text editor. I shouldn&#x27;t need to be an extremely hardcore JS programmer or use a crazy static site generator or overengineered LAMP backend to do basic things like reusing HTML and other things that could be largely accomplished with just HTML itself.
评论 #18465381 未加载
评论 #18463454 未加载
评论 #18465261 未加载
评论 #18464962 未加载
评论 #18463873 未加载
评论 #18464264 未加载
评论 #18466343 未加载
评论 #18465984 未加载
ravenstine超过 6 年前
I really hope that web components take off, because I&#x27;m getting pretty tired of having to learn different ways of building components every damned year. Most components don&#x27;t need blazing-fast rendering engines, the templating engine of the now, or even two-way bindings out of the box, and thus I&#x27;d like to use components that can live on their own but also be easily wrapped into whatever framework I&#x27;m using.<p>I&#x27;d like frameworks to be a lot closer to <i>scaffolds</i>, or actually be <i>frameworks</i>, as opposed to what most of them are now which is reimplementations of application units. The web components standard can help make it possible for tools to become interoperable between frameworks(okay, and <i>view libraries</i>), that would be wonderful.
评论 #18462850 未加载
评论 #18463896 未加载
评论 #18464071 未加载
评论 #18466590 未加载
littlecranky67超过 6 年前
WebComponents only solve the problem of creating independent, self-contained functional units for the web. They don&#x27;t fix all the other issues modern framework stacks try to fix like state management, change detection, two-way binding, inter-component communication&#x2F;data passing etc. Thats why I don&#x27;t see the framework soup (Angular, React, Vue, Ember, Aurelia) going anywhere in the near future. Maybe the &quot;component&quot; part will converge in the frameworks towards WebComponents but all the other bits and pieces the framework stacks ship will remain.
SEJeff超过 6 年前
I believe Home Assistant&#x27;s new fancy UI codenamed &quot;lovelace&quot; is based on web components: <a href="https:&#x2F;&#x2F;www.home-assistant.io&#x2F;lovelace&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.home-assistant.io&#x2F;lovelace&#x2F;</a><p>This should give you a sense of the power of web components.
option_greek超过 6 年前
It&#x27;s weird that the default behavior when appending a template is to not clone it requiring an additional clone call<p>&gt;&gt;template.content.cloneNode(true)
评论 #18463856 未加载
superbaconman超过 6 年前
I&#x27;m not such a fan of how spread out everything is. I&#x27;d really like to see html, js, and css all together in one place. React is the best I&#x27;ve seen, but it doesn&#x27;t provide a good solution for css.
评论 #18465411 未加载
评论 #18465776 未加载
评论 #18466510 未加载
ehnto超过 6 年前
I put together a micro-pattern for working with WebComponents that I really wish were cross browser compatible as it is. It works in Firefox and Chrome and it is partly how I wish the web would move forward.<p>There is no technical limitations to making encapsulated portable pieces of html, css and js, yet it seems a very uncommon practice to make libraries of small re-usable components, even if they are boutique to you or your company. I think that is partly down to how we go about specing out and producing websites, and partly down to the fact that many don&#x27;t realise you can already do it.<p><a href="https:&#x2F;&#x2F;polylab.co&#x2F;projects&#x2F;polyblocks.html" rel="nofollow">https:&#x2F;&#x2F;polylab.co&#x2F;projects&#x2F;polyblocks.html</a><p>An important part of that is well encapsulated CSS, and theming on top of that, something I have written a little bit about as well.<p><a href="https:&#x2F;&#x2F;polylab.co&#x2F;articles&#x2F;ccm-contexts-and-components-css.html" rel="nofollow">https:&#x2F;&#x2F;polylab.co&#x2F;articles&#x2F;ccm-contexts-and-components-css....</a>
robocat超过 6 年前
caniuse shadow components:<p><a href="https:&#x2F;&#x2F;caniuse.com&#x2F;#feat=shadowdomv1" rel="nofollow">https:&#x2F;&#x2F;caniuse.com&#x2F;#feat=shadowdomv1</a><p>So not Edge (I loath testing MSEdge - always finding new bugs in it - yesterday the F12 development tools crashed even on a blank page -- needed an opaque powershell script from MS to fix it...)
rado超过 6 年前
Amazingly, Shadow DOM does not block all outside CSS. The * properties leak in, unless you add #container { all: initial; } inside, but that doesn&#x27;t work in Firefox. I wonder why authors forget this strange fact.
评论 #18465434 未加载
ausjke超过 6 年前
I could be totally wrong here as I am not an expert in frontend, it seems Google has been the loner pushing web component(polymer,etc). Mozilla was lukewarm about it. Something changed or did I miss something badly?<p>Vuejs has its own web-component(non-standardized), so does React. If browsers can provide native web-component support that will be really nice.
评论 #18465748 未加载
Flenser超过 6 年前
Web components may give power to developers but they take it away from users. Any page made with web components is hostile to user styling. I&#x27;m surprised Mozilla would support them.
评论 #18463186 未加载
评论 #18462511 未加载
评论 #18462444 未加载
评论 #18463545 未加载
评论 #18462607 未加载
评论 #18462663 未加载
评论 #18463549 未加载
评论 #18464463 未加载