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

Introducing Web Components

Peter Gasston
September 24, 2013

Introducing Web Components

SmartWeb conference, 24th September 2013.

Peter Gasston

September 24, 2013
Tweet

More Decks by Peter Gasston

Other Decks in Technology

Transcript

  1. .foo { color: #00f; } The problem <div class="foo"> …

    </div> div.foo { color: #f00; } <div class="foo"> … </div>
  2. Templates + Shadow DOM var newRoot = $(foo).createShadowRoot(), clone =

    $(bar).content.cloneNode(true), newRoot.innerHTML = clone;
  3. Templates + Shadow DOM var newRoot = $(foo).createShadowRoot(), newEl =

    document.createElement('content'); newRoot.innerHTML = newEl;
  4. The part attribute var newRoot = el.createShadowRoot(), newEl = '<h2

    part="apes">…</h2>'; newRoot.appendChild(newEl);
  5. <p>Hello</p> <div> <style scoped> p { color: #f00; } </style>

    <p>World!</p> </div> <p>Again</p> Scoped styles
  6. Shadow DOM Shadow DOM API Templates HTML imports Custom elements

    Scoped styles Custom properties Browser support