Upgrade to Pro — share decks privately, control downloads, hide ads and more …

HTML5 WebComponents Primer

HTML5 WebComponents Primer

An older Talk I gave some time ago, refreshed for an upcoming Team event.

Mirko Sertic

May 06, 2017
Tweet

More Decks by Mirko Sertic

Other Decks in Programming

Transcript

  1. @mirkosertic | [email protected] | https://www.mirkosertic.de
    WebComponents Primer

    View full-size slide

  2. @mirkosertic | [email protected] | https://www.mirkosertic.de
    Als Primer (Pl.: die Primer; IPA:
    [ˊpʁaɪ̯mɐ]) wird in der Molekularbiologie
    ein Oligonukleotid bezeichnet, das als
    Startpunkt für DNA-replizierende
    Enzyme wie die DNA-Polymerase dient.

    View full-size slide

  3. @mirkosertic | [email protected] | https://www.mirkosertic.de
    2D / 3D Canvas
    Microdata
    Drag & Drop API
    WebComponents
    Cross Document Messaging

    View full-size slide

  4. @mirkosertic | [email protected] | https://www.mirkosertic.de
    2D / 3D Canvas
    Microdata
    Drag & Drop API
    WebComponents
    Cross Document Messaging

    View full-size slide

  5. @mirkosertic | [email protected] | https://www.mirkosertic.de
    WebComponents


    Tab1
    Tab2


    View full-size slide

  6. @mirkosertic | [email protected] | https://www.mirkosertic.de
    WebComponents





    Tab1
    Tab2


    View full-size slide

  7. @mirkosertic | [email protected] | https://www.mirkosertic.de
    WebComponents

    Titel meiner tollen Tab Komponente





    View full-size slide

  8. @mirkosertic | [email protected] | https://www.mirkosertic.de
    WebComponents


    Titel meiner tollen Tab Komponente





    View full-size slide

  9. @mirkosertic | [email protected] | https://www.mirkosertic.de
    WebComponents
    <br/>var importDoc = document.currentScript.ownerDocument;<br/>var myTabViewPrototype = Object.create(HTMLElement.prototype);<br/>myTabPrototype.createdCallback = function() {<br/>var shadow = this.createShadowRoot();<br/>var template = importDoc.querySelector('#mytemplate');<br/>shadow.appendChild(template.content.cloneNode(true));<br/>};<br/>document.registerElement(‘my-tabview‘, {<br/>prototype: myTabViewPrototype<br/>});<br/>

    View full-size slide

  10. @mirkosertic | [email protected] | https://www.mirkosertic.de
    WebComponents
    <br/>var importDoc = document.currentScript.ownerDocument;<br/>var myTabViewPrototype = Object.create(HTMLElement.prototype);<br/>myTabPrototype.createdCallback = function() {<br/>var shadow = this.createShadowRoot();<br/>var template = importDoc.querySelector('#mytemplate');<br/>shadow.appendChild(template.content.cloneNode(true));<br/>};<br/>document.registerElement(‘my-tabview‘, {<br/>prototype: myTabViewPrototype<br/>});<br/>
    1

    View full-size slide

  11. @mirkosertic | [email protected] | https://www.mirkosertic.de
    WebComponents
    <br/>var importDoc = document.currentScript.ownerDocument;<br/>var myTabViewPrototype = Object.create(HTMLElement.prototype);<br/>myTabPrototype.createdCallback = function() {<br/>var shadow = this.createShadowRoot();<br/>var template = importDoc.querySelector('#mytemplate');<br/>shadow.appendChild(template.content.cloneNode(true));<br/>};<br/>document.registerElement(‘my-tabview‘, {<br/>prototype: myTabViewPrototype<br/>});<br/>
    1
    2

    View full-size slide

  12. @mirkosertic | [email protected] | https://www.mirkosertic.de
    WebComponents
    <br/>var importDoc = document.currentScript.ownerDocument;<br/>var myTabViewPrototype = Object.create(HTMLElement.prototype);<br/>myTabPrototype.createdCallback = function() {<br/>var shadow = this.createShadowRoot();<br/>var template = importDoc.querySelector('#mytemplate');<br/>shadow.appendChild(template.content.cloneNode(true));<br/>};<br/>document.registerElement(‘my-tabview‘, {<br/>prototype: myTabViewPrototype<br/>});<br/>
    1
    2
    3

    View full-size slide

  13. @mirkosertic | [email protected] | https://www.mirkosertic.de
    WebComponents



    Tab1
    Tab2

    View full-size slide

  14. @mirkosertic | [email protected] | https://www.mirkosertic.de
    WebComponents



    Tab1
    Tab2
    Shadow DOM
    Host Shadow DOM
    Root

    View full-size slide

  15. @mirkosertic | [email protected] | https://www.mirkosertic.de
    Komplexe Anwendung

    View full-size slide

  16. @mirkosertic | [email protected] | https://www.mirkosertic.de
    Komplexe Anwendung

    View full-size slide

  17. @mirkosertic | [email protected] | https://www.mirkosertic.de
    Stand der Implementierung

    View full-size slide

  18. @mirkosertic | [email protected] | https://www.mirkosertic.de
    Was gibt es noch?
    Google Polymer
    Vue.js

    View full-size slide

  19. @mirkosertic | [email protected] | https://www.mirkosertic.de
    Fragen?
    falls nicht, besten Dank für die
    Aufmerksamkeit!

    View full-size slide