SlideShare a Scribd company logo
Web Components, so close!
Oleksandr Zinevych
Software Engineer at Datamart Inc.
Agenda
• How our markup looks today?
• Web Components will help us!
• Inner structure
• Simple web component live
• Current state, known issues and future plans
How your frontend code looks like?
Web components, so close!
Main problems here
• We have too many similar components in our web page that fall
under the same semantic structure. To distinguish them from
each other, we use classes, IDs, or other attributes.
• The available list of semantic tags are simply not enough to
target the wide variety of components that constitute our design.
As a result, we fall back to traditional tags like div or span.
Web Components?
• Web Components are a set of standards currently being
produced by Google engineers as a W3C specification
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 WWW.
Web Components aren’t new!
(1998) HTML Components - was proposed and
implemented by Microsoft starting in IE5.5 (obsoleted
in IE10).
XBL(2001) and XBL2(2007) - was proposed by
Mozilla as a companion to their XUL user-interface
language.
Web Components
TEMPLATES SHADOW DOM HTML IMPORT
CUSTOM
ELEMENTS
<template id=“”>
</template>
div
#document fragment
span
<link rel=“import”
href=“doc.html”>
<my-elem></my-elem>
Templates
• The HTML template element <template> is a mechanism for
holding client-side content that is not to be rendered when a
page is loaded but may subsequently be instantiated during
runtime using JavaScript.
• Its content is effectively inert until activated.
• Script doesn't run, images don't load, audio doesn't play,...until
the template is used.
• Content is considered not to be in the document.
• Templates can be placed anywhere inside of <head>, <body>,
or <frameset> and can contain any type of content.
Activation of template
Gotchas, you need to remember
• You cannot prerender a template(preload assets, process JS or
etc.)
• Avoid nested template because of activation.
Shadow DOM
DOM tree encapsulation
• DOM nodes can already “host” hidden DOM
• The hidden DOM cannot be accessed from outside JS
• Styles defined in Shadow DOM are scoped by default
How can you see it?
Web components, so close!
• Shadow Host: is the DOM element which is hosting the Shadow
DOM subtree or it is the DOM node which contains the Shadow
Root.
• Shadow Root: is the root of the DOM subtree containing the
shadow DOM nodes.
• Shadow DOM: allows for multiple DOM subtrees to be
composed into one larger tree while rendering.
Web components, so close!
Lets create it!
Why Shadow DOM?
• Separate your Content from Presentation (<content> tag)
• Style and DOM encapsulation
Think about how you load HTML on the web?
HTML Import
<iframe>
AJAX
Other Hacks?
How it looks?
Recommendations
• Concatenate imports
• Do not forget about browser caching
• Imports block rendering(use async if needed)
Custom Elements
Simple creation
Advanced creation
• You can extend both native and previously created custom
elements:
Events
• createdCallback – when an instance of the element is created
• attachedCallback - when an instance was inserted into the
document
• detachedCallback – when an instance was removed from the
document
• attributeChangedCallback – when an attribute was added,
removed, or updated
How it works?
Isn’t markup sexy?
Web Components are coming!
• At the beginning it was just a Google intention. For now
discussions about specifications are between Mozilla, Google,
Apple, Microsoft.
• The whole vision of Web Components is not fully realized and
discussed by all browser vendors. But we can experiment with
them now.
• Web Components are a transformative step forward for the web
Browsers are not ready
• Shadow DOM spec compromise
• Custom elements, HTML Imports are still controversial
• Templates are broadly supported
Future of Web Components
Declarative shadow DOM
Fully Isolated Components
Accessibility primitives
Unified native control styling
CSS Parts styling
Parser customization
Thanks for attention!
• E-mail: aleksanderzinewicz@gmail.com
• Twitter: @a_zinewicz
• Facebook: @aleksander.zinewicz
• Skype: oleksandr.zinevych@outlook.com

More Related Content

PPTX
Web Components
PPTX
Web Components
PDF
Build Reusable Web Components using HTML5 Web cComponents
PDF
Introduction to Web Components
PPTX
Web Atoms - More Markup - Less Script
PDF
Front-End Frameworks: a quick overview
KEY
PDF
Custom Elements with Polymer Web Components #econfpsu16
Web Components
Web Components
Build Reusable Web Components using HTML5 Web cComponents
Introduction to Web Components
Web Atoms - More Markup - Less Script
Front-End Frameworks: a quick overview
Custom Elements with Polymer Web Components #econfpsu16

What's hot (20)

PPTX
Introduction to HTML5 & CSS3
PPTX
SoCal Code Camp 2011 - ASP.NET 4.5
PDF
Bundle Splitting in Volto
PPTX
Journey To The Front End World - Part3 - The Machine
PPTX
Html5 with SharePoint 2010
PDF
HTML5 and CSS3: does now really mean now?
PDF
Building a Better Web with HTML5 and CSS3
PPTX
NOLOH PHP Framework - Unified Server-Side Development
PPTX
Harness jQuery Templates and Data Link
PPTX
To build a WordPress Theme: Wordcamp Denmark 2014
PDF
Hybrid Mobile Apps | Ionic & AngularJS
PPTX
2012 - HTML5, CSS3 and jQuery with SharePoint 2010
PDF
Javascript - Getting started | DevCom ISITCom
PDF
BP101: A Modernized Workflow w/ Domino/XPages
PDF
The web context
PDF
Les Basiques - Web Développement HTML5, CSS3, JS et PHP
PPT
Ashish
PPTX
Php Indonesia x Bliblidotcom - Architecting Scalable CSS
PDF
Levent-Gurses' Introduction to Web Components & Polymer
Introduction to HTML5 & CSS3
SoCal Code Camp 2011 - ASP.NET 4.5
Bundle Splitting in Volto
Journey To The Front End World - Part3 - The Machine
Html5 with SharePoint 2010
HTML5 and CSS3: does now really mean now?
Building a Better Web with HTML5 and CSS3
NOLOH PHP Framework - Unified Server-Side Development
Harness jQuery Templates and Data Link
To build a WordPress Theme: Wordcamp Denmark 2014
Hybrid Mobile Apps | Ionic & AngularJS
2012 - HTML5, CSS3 and jQuery with SharePoint 2010
Javascript - Getting started | DevCom ISITCom
BP101: A Modernized Workflow w/ Domino/XPages
The web context
Les Basiques - Web Développement HTML5, CSS3, JS et PHP
Ashish
Php Indonesia x Bliblidotcom - Architecting Scalable CSS
Levent-Gurses' Introduction to Web Components & Polymer
Ad

Viewers also liked (6)

PDF
Architecture of a Modern Web App - SpringOne India
PPTX
Watson - a supercomputer
PPTX
Modularizing RESTful Web Service Management with Aspect Oriented Programming
PPTX
Chrome extensions
PDF
IBM Watson & Open Source Software - LinuxCon 2012
PDF
REST vs. SOAP
Architecture of a Modern Web App - SpringOne India
Watson - a supercomputer
Modularizing RESTful Web Service Management with Aspect Oriented Programming
Chrome extensions
IBM Watson & Open Source Software - LinuxCon 2012
REST vs. SOAP
Ad

Similar to Web components, so close! (20)

PDF
Webcomponents v2
PPTX
Web components
PDF
Webcomponents TLV October 2014
PDF
Introduction to Web Components
PDF
Web component driven development
PDF
2014 03-25 - GDG Nantes - Web Components avec Polymer
PDF
Web Components: The future of Web Application Development
PPTX
Rawnet Lightning Talk - Web Components
PPT
Reaching for the Future with Web Components and Polymer
PPTX
Introduction to Webcomponents
PDF
Brownbag on basics of web components
PDF
Web components
PDF
Modern Web UI - Web components
PDF
Presentation About The Web Components | Selma SALTIK
PDF
Web Components - The Future is Here
PPTX
An Introduction to Web Components
PDF
Web components - The Future is Here
PDF
Real World Web components
PDF
Web components the future is here
PPTX
Web Components: Introduction and Practical Use Cases
Webcomponents v2
Web components
Webcomponents TLV October 2014
Introduction to Web Components
Web component driven development
2014 03-25 - GDG Nantes - Web Components avec Polymer
Web Components: The future of Web Application Development
Rawnet Lightning Talk - Web Components
Reaching for the Future with Web Components and Polymer
Introduction to Webcomponents
Brownbag on basics of web components
Web components
Modern Web UI - Web components
Presentation About The Web Components | Selma SALTIK
Web Components - The Future is Here
An Introduction to Web Components
Web components - The Future is Here
Real World Web components
Web components the future is here
Web Components: Introduction and Practical Use Cases

Recently uploaded (20)

PDF
Nekopoi APK 2025 free lastest update
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
System and Network Administraation Chapter 3
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
L1 - Introduction to python Backend.pptx
PPTX
ai tools demonstartion for schools and inter college
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
history of c programming in notes for students .pptx
Nekopoi APK 2025 free lastest update
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Odoo POS Development Services by CandidRoot Solutions
System and Network Administraation Chapter 3
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PTS Company Brochure 2025 (1).pdf.......
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Understanding Forklifts - TECH EHS Solution
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Wondershare Filmora 15 Crack With Activation Key [2025
VVF-Customer-Presentation2025-Ver1.9.pptx
Design an Analysis of Algorithms II-SECS-1021-03
Operating system designcfffgfgggggggvggggggggg
L1 - Introduction to python Backend.pptx
ai tools demonstartion for schools and inter college
2025 Textile ERP Trends: SAP, Odoo & Oracle
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
history of c programming in notes for students .pptx

Web components, so close!

  • 1. Web Components, so close! Oleksandr Zinevych Software Engineer at Datamart Inc.
  • 2. Agenda • How our markup looks today? • Web Components will help us! • Inner structure • Simple web component live • Current state, known issues and future plans
  • 3. How your frontend code looks like?
  • 5. Main problems here • We have too many similar components in our web page that fall under the same semantic structure. To distinguish them from each other, we use classes, IDs, or other attributes. • The available list of semantic tags are simply not enough to target the wide variety of components that constitute our design. As a result, we fall back to traditional tags like div or span.
  • 7. • Web Components are a set of standards currently being produced by Google engineers as a W3C specification 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 WWW.
  • 8. Web Components aren’t new! (1998) HTML Components - was proposed and implemented by Microsoft starting in IE5.5 (obsoleted in IE10). XBL(2001) and XBL2(2007) - was proposed by Mozilla as a companion to their XUL user-interface language.
  • 9. Web Components TEMPLATES SHADOW DOM HTML IMPORT CUSTOM ELEMENTS <template id=“”> </template> div #document fragment span <link rel=“import” href=“doc.html”> <my-elem></my-elem>
  • 11. • The HTML template element <template> is a mechanism for holding client-side content that is not to be rendered when a page is loaded but may subsequently be instantiated during runtime using JavaScript.
  • 12. • Its content is effectively inert until activated. • Script doesn't run, images don't load, audio doesn't play,...until the template is used. • Content is considered not to be in the document. • Templates can be placed anywhere inside of <head>, <body>, or <frameset> and can contain any type of content.
  • 14. Gotchas, you need to remember • You cannot prerender a template(preload assets, process JS or etc.) • Avoid nested template because of activation.
  • 16. DOM tree encapsulation • DOM nodes can already “host” hidden DOM • The hidden DOM cannot be accessed from outside JS • Styles defined in Shadow DOM are scoped by default
  • 17. How can you see it?
  • 19. • Shadow Host: is the DOM element which is hosting the Shadow DOM subtree or it is the DOM node which contains the Shadow Root. • Shadow Root: is the root of the DOM subtree containing the shadow DOM nodes. • Shadow DOM: allows for multiple DOM subtrees to be composed into one larger tree while rendering.
  • 22. Why Shadow DOM? • Separate your Content from Presentation (<content> tag) • Style and DOM encapsulation
  • 23. Think about how you load HTML on the web?
  • 26. Recommendations • Concatenate imports • Do not forget about browser caching • Imports block rendering(use async if needed)
  • 29. Advanced creation • You can extend both native and previously created custom elements:
  • 30. Events • createdCallback – when an instance of the element is created • attachedCallback - when an instance was inserted into the document • detachedCallback – when an instance was removed from the document • attributeChangedCallback – when an attribute was added, removed, or updated
  • 33. Web Components are coming! • At the beginning it was just a Google intention. For now discussions about specifications are between Mozilla, Google, Apple, Microsoft. • The whole vision of Web Components is not fully realized and discussed by all browser vendors. But we can experiment with them now. • Web Components are a transformative step forward for the web
  • 34. Browsers are not ready • Shadow DOM spec compromise • Custom elements, HTML Imports are still controversial • Templates are broadly supported
  • 35. Future of Web Components Declarative shadow DOM Fully Isolated Components Accessibility primitives Unified native control styling CSS Parts styling Parser customization
  • 36. Thanks for attention! • E-mail: aleksanderzinewicz@gmail.com • Twitter: @a_zinewicz • Facebook: @aleksander.zinewicz • Skype: oleksandr.zinevych@outlook.com