SlideShare a Scribd company logo
1 of 45
Download to read offline
Web Components 
A revolution ? 
@cbalit 0
Why components ? 
This is the way we already do it 
For widgets ? applications ? pluggins ? 
Reusable 
Encapsulated 
Extendable
What is it ? 
4 specifications 
1. Html Import 
2. Shadow Dom 
3. Template 
4. Custom Element
Html Import
What is it ? 
Include an HTML element inside another one
How ? 
<link rel="import" href="/path/myfile.html"> 
CORS 
Load once 
Don't block page parsing
Get the content 
HTML and CSS are just loaded but not included (available) We 
retrieve the content using the import property 
<link id="my-import" rel="import" href="myfile.html"> 
<script> 
var link = document.querySelector('#my-import'); 
var content = link.import; 
//I can now acces to my content 
var el = content.querySelector('.mySelector'); 
document.body.appendChild(el.cloneNode(true)); 
</script>
And for Javascript ... 
Run in the page context 
Can access to its DOM ... 
... and the one from the page 
<script> 
var importDoc = document.currentScript.ownerDocument; 
var mainDoc = document; 
</script>
Events 
Load and Error Event 
<script async=""> 
function handleLoad(e) { 
console.log('Loaded import: ' + e.target.href); 
} 
function handleError(e) { 
console.log('Error loading import: ' + e.target.href); 
} 
</script> 
<link rel="import" href="file.html" onload="handleLoad(event)" onerror="handleError(event)"
Support
Shadow Dom
Old !!!! 
Browsers already use it 
<input type="range"> 
<input type="date"> 
<input type="hour"> 
jj/mm/aaaa
What is it ? 
It's all about Encapsulation
What does this mean 
Isolated container 
New kind of node 
shadow root 
shadow host
With Javascript 
createShadowRoot 
element.shadowRoot 
<button>Normal button!</button> 
<button id="myBtn">Hello, world!</button> 
<script> 
var host = document.querySelector('#myBtn'); 
var root = host.createShadowRoot(); 
root.textContent = 'こんにちは、影の世界!'; 
</script> 
Normal button! こんにちは、影の世界!
Shadow DOM versus Light 
DOM 
<my-element> 
<span>Hello</span> 
</my-element> 
visible sub-tree (childNodes, children, innerHTML ...) 
internal node 
composed DOM: what the browser see and render
Insertions points 
Define render area in the shadow dom 
No logical link 
<div id="host"> 
<span class="title">Hello too</span> 
<span>Bla Bla Bla</span> 
</div> 
<script> 
var shadow = document.querySelector('#host').createShadowRoot(); 
shadow.innerHTML = '<h1>In Shadow</h1>' + 
'<h2><content select=".title"></content></h2>' + 
'<section><content select="*"></content></section>'; 
</script>
Support
Template
What is it ? 
Reusable DOM template
Not in the document 
No side effect 
DOM not rendered 
Script not parsed 
Image not loaded
Usage 
1. Get the template with a selector 
2. acces to the content with the content property 
3. clone: he's alive 
4. insert the clone element in the page
Exemple 
<template id="mytemplate"> 
<img src="img/templates_64x64.png" alt="great image"> 
<div id="comment">My new comment</div> 
</template> 
<script> 
var t = document.querySelector('#mytemplate'); 
// Populate the src at runtime. 
t.content.querySelector('img').src = 'img/templates_64x64.png'; 
t.content.querySelector('#comment').innerHTML = 'My new comment'; 
var clone = document.importNode(t.content, true); 
document.body.appendChild(clone); 
</script> 
My new comment
Support
Custom element
What is it ? 
Define new HTML element 
Extend existing elements
How ? 
registerElement 
a name (with a -) 
a prototype (HTMLElement by default) 
<script> 
</script> 
<my-elt></my-elt> 
var myElt = document.registerElement('my-elt',HTMLElement.prototype);
Extend existing elements 
<script> 
var myButton = document.registerElement('my-button', { 
prototype: Object.create(HTMLButtonElement.prototype), 
extends: 'button' 
}); 
</script> 
<button is="”my-button”"></button>
Lifecycle 
Declaration vs register 
Seen as unresolved 
pseudo-selector :unresolved 
<style> 
*:unresolved { 
color: red; 
} 
</style> 
<my-element>register</my-element> 
<button onclick="document.registerElement('my-element')">Register</button> 
i'm unresolved Register
Callback 
createdCallback 
attachedCallback 
detachedCallback 
attributeChangedCallback 
var myElemtProto = Object.create(HTMLElement.prototype); 
myElemtProto.createdCallback = function() {}; 
var myElemt = document.registerElement('my-element', myElemtProto);
Add content
innerHTML 
myEltProto.createdCallback = function() { 
this.innerHTML = "<b>un peu de contenu!</b>"; 
};
shadowDom 
myEltProto.createdCallback = function() { 
var shadow = this.createShadowRoot(); 
shadow.innerHTML = "<b>un peu de contenu!</b>"; 
};
Template 
<template id="sdtemplate"> 
</template> 
myEltProto.createdCallback = function() { 
var t = document.querySelector('#sdtemplate'); 
var clone = document.importNode(t.content, true); 
this.createShadowRoot().appendChild(clone); 
};
Add code
The prototype 
myEltProto.myFctn=function(){...} 
Object.defineProperty(myEltProto, "bar", {value: 5});
Support
And so what ?
Real good specification 
Can be used alone 
But a weak support 
So what can we do ?
POLYMER 
polyfills (platform.js) 
components (core-elements, paper-elements) 
sugaring (polymer.js)
X-TAG 
Web Components Polyfills (custom element et HTMLImports) 
X-Tag Custom Elements 
X-Tag Core Library
BOSONIC 
polyfills (platform.js) 
components
Ressources Import 
Shadow Dom 
Styling Shadow Dom 
Template 
Custom Elements 
The Web Component Ecosystem 
Polymer 
X-Tag 
Bosonic 
Credits: Eric Bidelman,Rob Dodson,Dominic Cooney
Thank you !!! 
cbalit
My new comment

More Related Content

What's hot

jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginningAnis Ahmad
 
Don't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQueryDon't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQueryshabab shihan
 
Web Components: The future of Web Application Development
Web Components: The future of Web Application DevelopmentWeb Components: The future of Web Application Development
Web Components: The future of Web Application DevelopmentJermaine Oppong
 
Difference between java script and jquery
Difference between java script and jqueryDifference between java script and jquery
Difference between java script and jqueryUmar Ali
 
AngulrJS Overview
AngulrJS OverviewAngulrJS Overview
AngulrJS OverviewEyal Vardi
 
Assignment4
Assignment4Assignment4
Assignment4H K
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery PresentationRod Johnson
 
Web Projects: From Theory To Practice
Web Projects: From Theory To PracticeWeb Projects: From Theory To Practice
Web Projects: From Theory To PracticeSergey Bolshchikov
 
HTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebHTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebRobert Nyman
 
Polymer - pleasant client-side programming with web components
Polymer - pleasant client-side programming with web componentsPolymer - pleasant client-side programming with web components
Polymer - pleasant client-side programming with web componentspsstoev
 
Getting classy with ES6
Getting classy with ES6Getting classy with ES6
Getting classy with ES6Andy Sharman
 
Front End Development: The Important Parts
Front End Development: The Important PartsFront End Development: The Important Parts
Front End Development: The Important PartsSergey Bolshchikov
 
Rails GUI Development with Ext JS
Rails GUI Development with Ext JSRails GUI Development with Ext JS
Rails GUI Development with Ext JSMartin Rehfeld
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQueryorestJump
 

What's hot (20)

jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
Don't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQueryDon't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQuery
 
Introducing jQuery
Introducing jQueryIntroducing jQuery
Introducing jQuery
 
J Query Public
J Query PublicJ Query Public
J Query Public
 
Web Components: The future of Web Application Development
Web Components: The future of Web Application DevelopmentWeb Components: The future of Web Application Development
Web Components: The future of Web Application Development
 
Difference between java script and jquery
Difference between java script and jqueryDifference between java script and jquery
Difference between java script and jquery
 
AngulrJS Overview
AngulrJS OverviewAngulrJS Overview
AngulrJS Overview
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
jQuery
jQueryjQuery
jQuery
 
Assignment4
Assignment4Assignment4
Assignment4
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
 
Web Projects: From Theory To Practice
Web Projects: From Theory To PracticeWeb Projects: From Theory To Practice
Web Projects: From Theory To Practice
 
HTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebHTML5 - The 2012 of the Web
HTML5 - The 2012 of the Web
 
Polymer - pleasant client-side programming with web components
Polymer - pleasant client-side programming with web componentsPolymer - pleasant client-side programming with web components
Polymer - pleasant client-side programming with web components
 
Javascript
JavascriptJavascript
Javascript
 
Java script
Java scriptJava script
Java script
 
Getting classy with ES6
Getting classy with ES6Getting classy with ES6
Getting classy with ES6
 
Front End Development: The Important Parts
Front End Development: The Important PartsFront End Development: The Important Parts
Front End Development: The Important Parts
 
Rails GUI Development with Ext JS
Rails GUI Development with Ext JSRails GUI Development with Ext JS
Rails GUI Development with Ext JS
 
Introduzione JQuery
Introduzione JQueryIntroduzione JQuery
Introduzione JQuery
 

Viewers also liked

Claire Casey Relationship
Claire Casey RelationshipClaire Casey Relationship
Claire Casey Relationshipkriegerhrc
 
Reckley johnny ignite_slidshare
Reckley johnny ignite_slidshareReckley johnny ignite_slidshare
Reckley johnny ignite_slidshareJohnny Reckley
 
The importance of pdhpe
The importance of pdhpeThe importance of pdhpe
The importance of pdhpeShilert
 
Reputation Local Brand Establisher PowerPoint
Reputation Local Brand Establisher PowerPointReputation Local Brand Establisher PowerPoint
Reputation Local Brand Establisher PowerPointReputation Local
 
Belly Fat Burn
Belly Fat BurnBelly Fat Burn
Belly Fat Burnharoldejsk
 
Reputation Local Marketing for Restaurants PowerPoint
Reputation Local Marketing for Restaurants PowerPointReputation Local Marketing for Restaurants PowerPoint
Reputation Local Marketing for Restaurants PowerPointReputation Local
 
Reputation Local Marketing for Lawyers PowerPoint
Reputation Local Marketing for Lawyers PowerPointReputation Local Marketing for Lawyers PowerPoint
Reputation Local Marketing for Lawyers PowerPointReputation Local
 
Reputation Local Marketing for Cosmetic Surgeons PowerPoint
Reputation Local Marketing for Cosmetic Surgeons PowerPointReputation Local Marketing for Cosmetic Surgeons PowerPoint
Reputation Local Marketing for Cosmetic Surgeons PowerPointReputation Local
 
Reputation Local Marketing Budget PowerPoint
Reputation Local Marketing Budget PowerPointReputation Local Marketing Budget PowerPoint
Reputation Local Marketing Budget PowerPointReputation Local
 
Googale Acount
Googale AcountGoogale Acount
Googale Acountkriegerhrc
 
To master sha
To master shaTo master sha
To master shaZhu Lu
 
Thekidsarealright - superlatives
Thekidsarealright - superlativesThekidsarealright - superlatives
Thekidsarealright - superlativesVero GM
 
01 eskemak tipularena_dbh2
01 eskemak tipularena_dbh201 eskemak tipularena_dbh2
01 eskemak tipularena_dbh2Ixilik
 
Reputation Local Marketing for Accountants PowerPoint
Reputation Local Marketing for Accountants PowerPointReputation Local Marketing for Accountants PowerPoint
Reputation Local Marketing for Accountants PowerPointReputation Local
 
Reputation Local Brand Optimization PowerPoint
Reputation Local Brand Optimization PowerPointReputation Local Brand Optimization PowerPoint
Reputation Local Brand Optimization PowerPointReputation Local
 
The smart retrieval experiment
The smart retrieval experimentThe smart retrieval experiment
The smart retrieval experimentlogidhasan
 

Viewers also liked (20)

Claire Casey Relationship
Claire Casey RelationshipClaire Casey Relationship
Claire Casey Relationship
 
Reckley johnny ignite_slidshare
Reckley johnny ignite_slidshareReckley johnny ignite_slidshare
Reckley johnny ignite_slidshare
 
The importance of pdhpe
The importance of pdhpeThe importance of pdhpe
The importance of pdhpe
 
Reputation Local Brand Establisher PowerPoint
Reputation Local Brand Establisher PowerPointReputation Local Brand Establisher PowerPoint
Reputation Local Brand Establisher PowerPoint
 
Polymer
PolymerPolymer
Polymer
 
Belly Fat Burn
Belly Fat BurnBelly Fat Burn
Belly Fat Burn
 
Reputation Local Marketing for Restaurants PowerPoint
Reputation Local Marketing for Restaurants PowerPointReputation Local Marketing for Restaurants PowerPoint
Reputation Local Marketing for Restaurants PowerPoint
 
Reputation Local Marketing for Lawyers PowerPoint
Reputation Local Marketing for Lawyers PowerPointReputation Local Marketing for Lawyers PowerPoint
Reputation Local Marketing for Lawyers PowerPoint
 
Reputation Local Marketing for Cosmetic Surgeons PowerPoint
Reputation Local Marketing for Cosmetic Surgeons PowerPointReputation Local Marketing for Cosmetic Surgeons PowerPoint
Reputation Local Marketing for Cosmetic Surgeons PowerPoint
 
Reputation Local Marketing Budget PowerPoint
Reputation Local Marketing Budget PowerPointReputation Local Marketing Budget PowerPoint
Reputation Local Marketing Budget PowerPoint
 
Googale Acount
Googale AcountGoogale Acount
Googale Acount
 
To master sha
To master shaTo master sha
To master sha
 
Thekidsarealright - superlatives
Thekidsarealright - superlativesThekidsarealright - superlatives
Thekidsarealright - superlatives
 
A14-062
A14-062A14-062
A14-062
 
01 eskemak tipularena_dbh2
01 eskemak tipularena_dbh201 eskemak tipularena_dbh2
01 eskemak tipularena_dbh2
 
Bored Women
Bored WomenBored Women
Bored Women
 
CPR
CPR CPR
CPR
 
Reputation Local Marketing for Accountants PowerPoint
Reputation Local Marketing for Accountants PowerPointReputation Local Marketing for Accountants PowerPoint
Reputation Local Marketing for Accountants PowerPoint
 
Reputation Local Brand Optimization PowerPoint
Reputation Local Brand Optimization PowerPointReputation Local Brand Optimization PowerPoint
Reputation Local Brand Optimization PowerPoint
 
The smart retrieval experiment
The smart retrieval experimentThe smart retrieval experiment
The smart retrieval experiment
 

Similar to Devoxx 2014-webComponents

Real World Web components
Real World Web componentsReal World Web components
Real World Web componentsJarrod Overson
 
Web Components and Modular CSS
Web Components and Modular CSSWeb Components and Modular CSS
Web Components and Modular CSSAndrew Rota
 
Learning django step 1
Learning django step 1Learning django step 1
Learning django step 1永昇 陳
 
計算機概論20161212
計算機概論20161212計算機概論20161212
計算機概論20161212志宇 許
 
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationWeb Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationAndrew Rota
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScriptLilia Sfaxi
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and ImprovedTimothy Fisher
 
Java script frame history
Java script frame historyJava script frame history
Java script frame historyH K
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web ComponentsAndrew Rota
 
JavaScript DOM - Dynamic interactive Code
JavaScript DOM - Dynamic interactive CodeJavaScript DOM - Dynamic interactive Code
JavaScript DOM - Dynamic interactive CodeLaurence Svekis ✔
 
JavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptxJavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptxVivekBaghel30
 

Similar to Devoxx 2014-webComponents (20)

Client Web
Client WebClient Web
Client Web
 
Polymer 1.0
Polymer 1.0Polymer 1.0
Polymer 1.0
 
Real World Web components
Real World Web componentsReal World Web components
Real World Web components
 
Web Components and Modular CSS
Web Components and Modular CSSWeb Components and Modular CSS
Web Components and Modular CSS
 
Learning django step 1
Learning django step 1Learning django step 1
Learning django step 1
 
Javascript 2
Javascript 2Javascript 2
Javascript 2
 
計算機概論20161212
計算機概論20161212計算機概論20161212
計算機概論20161212
 
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationWeb Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing Combination
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
 
jQuery
jQueryjQuery
jQuery
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Java script frame history
Java script frame historyJava script frame history
Java script frame history
 
Web 6 | JavaScript DOM
Web 6 | JavaScript DOMWeb 6 | JavaScript DOM
Web 6 | JavaScript DOM
 
前端概述
前端概述前端概述
前端概述
 
The Complementarity of React and Web Components
The Complementarity of React and Web ComponentsThe Complementarity of React and Web Components
The Complementarity of React and Web Components
 
Java Script
Java ScriptJava Script
Java Script
 
JavaScript DOM - Dynamic interactive Code
JavaScript DOM - Dynamic interactive CodeJavaScript DOM - Dynamic interactive Code
JavaScript DOM - Dynamic interactive Code
 
JavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptxJavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptx
 
Dojo1.0_Tutorials
Dojo1.0_TutorialsDojo1.0_Tutorials
Dojo1.0_Tutorials
 
Dojo1.0_Tutorials
Dojo1.0_TutorialsDojo1.0_Tutorials
Dojo1.0_Tutorials
 

Recently uploaded

Radiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsRadiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsstephieert
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of indiaimessage0108
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Roomdivyansh0kumar0
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 

Recently uploaded (20)

Radiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsRadiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girls
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of india
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 

Devoxx 2014-webComponents

  • 1. Web Components A revolution ? @cbalit 0
  • 2. Why components ? This is the way we already do it For widgets ? applications ? pluggins ? Reusable Encapsulated Extendable
  • 3. What is it ? 4 specifications 1. Html Import 2. Shadow Dom 3. Template 4. Custom Element
  • 5. What is it ? Include an HTML element inside another one
  • 6. How ? <link rel="import" href="/path/myfile.html"> CORS Load once Don't block page parsing
  • 7. Get the content HTML and CSS are just loaded but not included (available) We retrieve the content using the import property <link id="my-import" rel="import" href="myfile.html"> <script> var link = document.querySelector('#my-import'); var content = link.import; //I can now acces to my content var el = content.querySelector('.mySelector'); document.body.appendChild(el.cloneNode(true)); </script>
  • 8. And for Javascript ... Run in the page context Can access to its DOM ... ... and the one from the page <script> var importDoc = document.currentScript.ownerDocument; var mainDoc = document; </script>
  • 9. Events Load and Error Event <script async=""> function handleLoad(e) { console.log('Loaded import: ' + e.target.href); } function handleError(e) { console.log('Error loading import: ' + e.target.href); } </script> <link rel="import" href="file.html" onload="handleLoad(event)" onerror="handleError(event)"
  • 12. Old !!!! Browsers already use it <input type="range"> <input type="date"> <input type="hour"> jj/mm/aaaa
  • 13. What is it ? It's all about Encapsulation
  • 14. What does this mean Isolated container New kind of node shadow root shadow host
  • 15. With Javascript createShadowRoot element.shadowRoot <button>Normal button!</button> <button id="myBtn">Hello, world!</button> <script> var host = document.querySelector('#myBtn'); var root = host.createShadowRoot(); root.textContent = 'こんにちは、影の世界!'; </script> Normal button! こんにちは、影の世界!
  • 16. Shadow DOM versus Light DOM <my-element> <span>Hello</span> </my-element> visible sub-tree (childNodes, children, innerHTML ...) internal node composed DOM: what the browser see and render
  • 17. Insertions points Define render area in the shadow dom No logical link <div id="host"> <span class="title">Hello too</span> <span>Bla Bla Bla</span> </div> <script> var shadow = document.querySelector('#host').createShadowRoot(); shadow.innerHTML = '<h1>In Shadow</h1>' + '<h2><content select=".title"></content></h2>' + '<section><content select="*"></content></section>'; </script>
  • 20. What is it ? Reusable DOM template
  • 21. Not in the document No side effect DOM not rendered Script not parsed Image not loaded
  • 22. Usage 1. Get the template with a selector 2. acces to the content with the content property 3. clone: he's alive 4. insert the clone element in the page
  • 23. Exemple <template id="mytemplate"> <img src="img/templates_64x64.png" alt="great image"> <div id="comment">My new comment</div> </template> <script> var t = document.querySelector('#mytemplate'); // Populate the src at runtime. t.content.querySelector('img').src = 'img/templates_64x64.png'; t.content.querySelector('#comment').innerHTML = 'My new comment'; var clone = document.importNode(t.content, true); document.body.appendChild(clone); </script> My new comment
  • 26. What is it ? Define new HTML element Extend existing elements
  • 27. How ? registerElement a name (with a -) a prototype (HTMLElement by default) <script> </script> <my-elt></my-elt> var myElt = document.registerElement('my-elt',HTMLElement.prototype);
  • 28. Extend existing elements <script> var myButton = document.registerElement('my-button', { prototype: Object.create(HTMLButtonElement.prototype), extends: 'button' }); </script> <button is="”my-button”"></button>
  • 29. Lifecycle Declaration vs register Seen as unresolved pseudo-selector :unresolved <style> *:unresolved { color: red; } </style> <my-element>register</my-element> <button onclick="document.registerElement('my-element')">Register</button> i'm unresolved Register
  • 30. Callback createdCallback attachedCallback detachedCallback attributeChangedCallback var myElemtProto = Object.create(HTMLElement.prototype); myElemtProto.createdCallback = function() {}; var myElemt = document.registerElement('my-element', myElemtProto);
  • 32. innerHTML myEltProto.createdCallback = function() { this.innerHTML = "<b>un peu de contenu!</b>"; };
  • 33. shadowDom myEltProto.createdCallback = function() { var shadow = this.createShadowRoot(); shadow.innerHTML = "<b>un peu de contenu!</b>"; };
  • 34. Template <template id="sdtemplate"> </template> myEltProto.createdCallback = function() { var t = document.querySelector('#sdtemplate'); var clone = document.importNode(t.content, true); this.createShadowRoot().appendChild(clone); };
  • 36. The prototype myEltProto.myFctn=function(){...} Object.defineProperty(myEltProto, "bar", {value: 5});
  • 39. Real good specification Can be used alone But a weak support So what can we do ?
  • 40. POLYMER polyfills (platform.js) components (core-elements, paper-elements) sugaring (polymer.js)
  • 41. X-TAG Web Components Polyfills (custom element et HTMLImports) X-Tag Custom Elements X-Tag Core Library
  • 43. Ressources Import Shadow Dom Styling Shadow Dom Template Custom Elements The Web Component Ecosystem Polymer X-Tag Bosonic Credits: Eric Bidelman,Rob Dodson,Dominic Cooney
  • 44. Thank you !!! cbalit