From a063ae3f7165b0070927169bfbd426d40b9d0a3d Mon Sep 17 00:00:00 2001 From: Monica Dinculescu Date: Fri, 24 Feb 2017 14:26:14 -0800 Subject: [PATCH] kevin review --- README.md | 55 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index d32f07c..203e881 100644 --- a/README.md +++ b/README.md @@ -9,43 +9,54 @@ A suite of polyfills supporting the [Web Components](http://webcomponents.org) s - **HTML Imports**: a way to include and reuse HTML documents via other HTML documents ([spec](https://w3c.github.io/webcomponents/spec/imports/)). - **Shadow DOM**: provides encapsulation by hiding DOM subtrees under shadow roots ([spec](https://w3c.github.io/webcomponents/spec/shadow/)). +For browsers that need it, there are also some minor polyfills included: +- [`HTMLTemplateElement`](https://github.com/webcomponents/template) +- [`Promise`](https://github.com/stefanpenner/es6-promise) +- `Event`, `CustomEvent`, `MouseEvent` constructors and `Object.assign`, `Array.from` (see [webcomponents-platform](https://github.com/webcomponents/webcomponents-platform)) + ## How to use The polyfills are built (concatenated & minified) into several bundles that target different browsers and spec readiness: -- `webcomponents-hi` -- HTML Imports (needed by Safari Tech Preview) -- `webcomponents-hi-ce` -- HTML Imports and Custom Elements (needed by Safari 10) -- `webcomponents-hi-sd-ce` -- HTML Imports, Custom Elements and Shady DOM/CSS (needed by Safari 9, Firefox, Edge) -- `webcomponents-sd-ce` -- Custom Elements and Shady DOM/CSS (no HTML Imports) -- `webcomponents-lite` -- all of the polyfills: HTML Imports, Custom Elements, Shady DOM/CSS and generic platform polyfills (such as Template, ES6 Promise, Constructable events, etc.) (needed by Internet Explorer 11) +- `webcomponents-hi.js` -- HTML Imports (needed by Safari Tech Preview) +- `webcomponents-hi-ce.js` -- HTML Imports and Custom Elements (needed by Safari 10) +- `webcomponents-hi-sd-ce.js` -- HTML Imports, Custom Elements and Shady DOM/CSS (needed by Safari 9, Firefox, Edge) +- `webcomponents-sd-ce.js` -- Custom Elements and Shady DOM/CSS (no HTML Imports) +- `webcomponents-lite.js` -- all of the polyfills: HTML Imports, Custom Elements, Shady DOM/CSS and generic platform polyfills (such as ES6 Promise, Constructable events, etc.) (needed by Internet Explorer 11), and Template (needed by IE 11 and Edge) -If you are only targetting a specific browser, you can just use the bundle that's -needed by it; alternatively, if you're using server-side rendering, you can -send the polyfill bundle that's necessary for the browser making that request. +If you are only targeting a specific browser, you can just use the bundle that's +needed by it; alternatively, if your server is capable of serving different assets based on user agent, you can send the polyfill bundle that's necessary for the browser making that request. ## `webcomponents-loader.js` Alternatively, this repo also comes with `webcomponents-loader.js`, a client-side -loader that dynamically loads the correct polyfill bundle, using feature detection. +loader that dynamically loads the minimum polyfill bundle, using feature detection. Note that because the bundle will be loaded asynchronously, you should wait for the `WebComponentsReady` before you can safely assume that all the polyfills have loaded and are ready to be used (i.e. if you want to dynamically load other custom elements, etc.). Here's an example: ``` - - - - + + + + + + + + + + + ``` ## Browser Support