Transcript
Page 1: Web Components -  presented at JS-Montréal Jun 2014

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

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

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

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

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
Page 7: Web Components -  presented at JS-Montréal Jun 2014
Page 8: Web Components -  presented at JS-Montréal Jun 2014
Page 9: Web Components -  presented at JS-Montréal Jun 2014

RESOURCES/POLYMER<*/>

Sacha Leprêtre @sachalepretre - Web Components - JS Montréal Jun 2014

Page 10: Web Components -  presented at JS-Montréal Jun 2014

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

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

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

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

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

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

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

Questions / More info

@sachalepretre


Top Related