Web Components are a set of features currently being added by the W3C to the HTML and DOM specifications that allow for the creation of reusable widgets or components in web documents and web applications. The intention behind them is to bring component-based software engineering to the World Wide Web. The components model allows for encapsulation and interoperability of individual HTML elements.
Web Components consist of 4 main features which can be used separately or all together:
There are two parts to Custom Elements: autonomous custom elements and customized built-in elements. Autonomous custom elements are HTML elements that are entirely separated from native HTML elements, they are essentially built from the bottom up using the Custom Elements API. Customized built-in elements are elements that are built upon native HTML elements to reuse their functionality.
Shadow DOM is a functionality that allows the web browser to render DOM elements without putting them into the main document DOM tree. This creates a barrier between what the developer and the browser can reach; the developer cannot access the Shadow DOM in the same way they would with nested elements, while the browser can render and modify that code the same way it would with nested elements. The impact of CSS scoped within the Shadow DOM of a particular element is that HTML elements can be encapsulated without the risk of CSS styles leaking and affecting elements that it was not supposed to affect. Although these elements are encapsulated with regard to HTML and CSS, they can still fire events that can be picked up by other elements in the document.
The scoped subtree in an element is called a shadow tree. The element the shadow tree is attached to is called a shadow host.
The syntax for doing an HTML import looks like this:
<link rel="import" href="mydocument.html">
To avoid loading and executing scripts twice that are introduced through imports, HTML import skips loading and executing files that have previously been loaded.
HTML Import is also related to an early idea in the development of hypertext called Transclusion, where all or part of an document is inserted into another by reference.
HTML template is a way to create insert chunks of HTML that are stamped at will. The syntax of HTML templates look like this:
<html> <template> <p>The HTML you wish to instantiate at will</p> </template> </html>
Scripts will not run, and resources that are inside a template will not be fetched until the template is stamped out.
Support for an early version of Custom Elements and Shadow DOM, known as "v0", is present in some Blink-based browsers like Google Chrome and Opera and is in Mozilla Firefox (requires a manual configuration change). The newer Custom Elements and Shadow DOM "v1" APIs are being implemented in Safari 10,Google Chrome (53.0.2785), and under development in Mozilla Firefox. Microsoft Edge has not started implementing Custom Elements or Shadow DOM yet.
There are several libraries that are built on Web Components with the aim of increasing the level of abstraction when creating custom elements. Four of the familiar libraries are X-Tag, Slim.js, Polymer, and Bosonic.
Two of these, Bosonic and Polymer, provide ready-made components that are free to use. These components can be used interchangeably as they are all built on open web technologies.[clarification needed]
Web Components were introduced by Alex Russell at Fronteers Conference 2011 for the first time. 
Manage research, learning and skills at defaultLogic. Create an account using LinkedIn or facebook to manage and organize your IT knowledge. defaultLogic works like a shopping cart for information -- helping you to save, discuss and share.