![Page 1: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/1.jpg)
Why and How theWeb Components ?
Sacha Leprêtre @sachalepretre
<*/>
JS-Montréal Jun 2014
![Page 2: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/2.jpg)
Intro: Lessons learned during the development of the project
Motto.<*/>
MOTTO:AnHTML5 editor using web components
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014http://mottoeditr.nteo.ca/
![Page 3: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/3.jpg)
What we are trying to solve…
…<body>
<img src=’…/animage.png’ width=’’ height=’’ ></img>…<video src=’http:/…/avideo.mp4’ controls></video>…<myComponent att1=’…’ attn=’…’></myComponent>
</body></html>
<*/>
Our own custom HTML tags ! And below with JS…
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014
var el = document.createElement(’myComponent’);el.setAttribute(’att1’,’…’);document.body.appendChild(el);
![Page 4: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/4.jpg)
RESOURCES
• http://www.w3.org/TR/components-intro/
• http://www.x-tags.org/index• http://mozilla.github.io/brick/index.ht
ml
• http://www.polymer-project.org/docs/start/usingelements.html
<*/>
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014
![Page 5: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/5.jpg)
RESOURCES/BRICKS<*/>
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014
https://developer.mozilla.org/en-US/Apps/Tools_and_frameworks/Web_components
![Page 6: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/6.jpg)
![Page 7: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/7.jpg)
![Page 8: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/8.jpg)
![Page 9: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/9.jpg)
RESOURCES/POLYMER<*/>
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014
![Page 10: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/10.jpg)
Why ?<*/>
Web Components are the ideal widgets we’ve never have !
<iframe>an extreme, not without implications
javascript widgetsFrameworksLibrairies
The moreDIRECTCONCRETEIn this direction
The moreINDIRECT
ABSTRACTEDIn this
direction
Parsing at runtime
Compiled
<webcomponents> of w3c (when full implemented by browsers)
! <webcomponents> of today (polyfills++)
Pure DOM
Pure JS
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014
![Page 11: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/11.jpg)
What else ?<*/>
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014
var el = document.querySelector(’myComponent’);var el2 = el.cloneNode(false);
document.body.appendChild(el2);
![Page 12: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/12.jpg)
Polyfills ++<*/>
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014
- X-tag - Polymer
![Page 13: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/13.jpg)
Compatibilities<*/>
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014
http://www.polymer-project.org/resources/compatibility.html
![Page 14: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/14.jpg)
Native vs polyfill<*/>
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014
Native vs polyfill.. Fragments (shadow-root), wrappers
Chrome Safari
![Page 15: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/15.jpg)
How they work ? …requirements<*/>
- CustomElement- HTMLTemplate- Scoping
- Discussions…
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014
![Page 16: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/16.jpg)
Differents ways...<*/>
- Custom Element Définition- W3C: (tags) and/or JS- Polymer: tags and/or JS- X-tags bricks: JS- Lïghtly: tags and/or JS
Discussions…
Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014
![Page 17: Web Components - presented at JS-Montréal Jun 2014](https://reader035.vdocuments.net/reader035/viewer/2022062418/554f45ceb4c90572088b5647/html5/thumbnails/17.jpg)
Questions / More info
@sachalepretre