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

Web Components: What, Why, How, When

Web Components: What, Why, How, When

Revised and updated version of an older talk, presented at the Web Components London meetup.

Peter Gasston

March 04, 2015
Tweet

More Decks by Peter Gasston

Other Decks in Programming

Transcript

  1. @stopsatgreen proto = Object.create(HTMLElement.prototype); proto.hooray = function() {…}; document.registerElement('fun-times',
 {

    prototype: proto }); funTimes = document.querySelector('fun-times');
 funTimes.hooray();
  2. @stopsatgreen var funTimes = document.querySelector('fun-times'); var proto = Object.create(HTMLElement.prototype); proto.hooray

    = function() {…}; proto.createdCallback = function() { var party = document.getElementById('party'); var clone = document.importNode(party.content,true); var root = funTimes.createShadowRoot(); root.appendChild(clone); } document.registerElement('fun-times', { prototype: proto });
  3. @stopsatgreen Browser Custom Elements Shadow DOM HTML Imports Template Who

    knows? ‘Under consideration’ ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ http://jonrimmer.github.io/are-we-componentized-yet/
  4. webcomponents.js (polyfills) Polymer Core Bosonic Core Elements Brick Paper Elements

    Elements polymer-project.org | brick.mozilla.io | bosonic.github.io | webcomponents.org Standard
  5. @stopsatgreen Web Components are for you to drive the future

    of the web. Please drive responsibly.