The document discusses web components, which include HTML templates, custom elements, shadow DOM, and HTML imports. Web components allow the creation of reusable custom elements with their own styles and DOM structure. They provide encapsulation and help avoid issues with global namespaces. While browser support is still emerging for some features, polyfills exist and frameworks like Polymer make web components accessible today. Web components represent an important evolution of the web that will improve how code is structured and shared.
5. HTML Templates
( traditionally )
<script type="text/x-template">
<h1>Hello World!</h1>
</script>
<div style="display:none">
<p>I am cloned over and over!</p>
</div>
8. Custom Elements
❯ MyEl = document.registerElement('my-el');
function my-el() { [native code] }
!
❯ var el = new MyEl();
undefined
!
❯ el.outerHTML;
"<my-el></my-el>"
31. vs Native
proto = Object.create(HTMLElement.prototype);
HelloWorld = document.registerElement(
‘hello-world', {
prototype : proto
});
What happened to <element>?