Chrome Web Components: Polymer needed?

白昼怎懂夜的黑 提交于 2019-12-09 12:29:46

问题


I understand Chrome is becoming complete in terms of Web components requirements.

Does that mean Polymer is no longer strictly needed?


回答1:


To be clear, the platform.js layer (the polyfills) go away as native support becomes available in browsers, but polymer.js (sugaring layer on top of web components) and the elements will not. The sugaring is Polymer's opinion on how to use the web components++ tech together, and the elements are generally useful/reusable components.

This post describes the pieces of Polymer: What is the difference between Polymer elements and AngularJS directives?

Today, it's not strictly true that you can use polymer without including the platform.js polyfills. We're working on making that possible now that there's one browser will native web components support. We're not quite there yet e.g. you still need to include platform.js in chrome 36.




回答2:


Web Components is a collective term for a group of technologies consisting of HTML Import, Templates, Custom Elements and ShadowDOM. Web components can be built with plain simple HTML, JavaScript and CSS. Polymer is a library that makes building web components super easy, and adds some additional benefits like two way data binding, support for touch events, and and good collection of ready to use components.

For support across browsers what you need is a polyfill, the most popular being webcomponents.js (the earlier one was called platform.js) . The webcomponents polyfill comes in multiple flavors. webcomponents.js which polyfills all the 4 technologies webcomponents-lite.js that polyfills everything except ShadowDOM. Polyfills for each of the individual technologies are also available. More info about polyfills can be found here http://webcomponents.org/polyfills/



来源:https://stackoverflow.com/questions/24945811/chrome-web-components-polymer-needed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!