3. 1998 2000 2002 2004 2006 2008 2010 2012 2014 2016 2018 2020
XMLHttpRequest ES5
HTML5
HTML4
GraphQL
CSS2
XML-RPC
Server Timing
Web Workers
Reporting API
Service Workers
Web App Manifest
WAI-ARIA
Feature Policy
CSS4
ES10
ES7
Custom Elements
ES9
CSS Shadow Parts
WebAssembly
Intersection Obs.
NEL
Shadow DOM
Media Queries
CSS3
REST
ES3
XHTML 1.0
Evolution of the Open Web *
* This is just a very small sample.
14. Web Components are a standardized set of browser
APIs that allow you to define your own HTML tags,
reusable and self-contained.
15. Benefits of Web Components
Improved
Maintainability
Improved
Reusability
Improved
Encapsulation
Standardization
16. Shadow DOM
Allows style and markup
to be encapsulated from
the regular DOM.
Custom Elements
Allows developers to
define their own
HTML tags.
HTML Templates
Allows to place markup
in a page that is only
parsed once necessary.
Key Web APIs
17. class Tab extends HTMLElement {
constructor() {
super();
this.attachShadow( { mode: 'open' } );
this.shadowRoot.innerHTML = `
<style>
/* scoped styles */
</style>
<slot></slot>
`;
}
static get observedAttributes() {
// Return list of attributes to watch.
}
attributeChangedCallback( name, oldValue, newValue ) {
// Run functionality when one of these attributes is changed.
}
connectedCallback() {
// Run functionality when an instance of this element is inserted into the DOM.
}
disconnectedCallback() {
// Run functionality when an instance of this element is removed from the DOM.
}
}
customElements.define( 'my-tab', Tab );
18. Current Browser Support
See full browser support
caniuse.com/#feat=custom-elementsv1
caniuse.com/#feat=shadowdomv1
caniuse.com/#feat=template
Also, check out the polyfill!
(github.com/webcomponents/custom-elements)
19. Interested in a technical deep dive?
● https://developers.google.com/web/fundamentals/web-components/customelements
● https://developers.google.com/web/fundamentals/web-components/shadowdom
● https://developers.google.com/web/fundamentals/web-components/best-practices
https://youtu.be/tIAhDR5ohnc?t=7661
33. Get Started with Web Components
LitElement
Following Best Practices
Web Components
Learning The Basics
AMP Framework
Reviewing Examples
Gutenberg
Building Blocks