Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
A future called Web Components
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Zeno Rocha
December 17, 2013
Programming
4.3k
27
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
A future called Web Components
HTML5 LA
Zeno Rocha
December 17, 2013
More Decks by Zeno Rocha
See All by Zeno Rocha
The Next Generation of Developer-First Products
zenorocha
1
740
7 Habits of Highly Productive Developers
zenorocha
1
450
7 Hábitos de Desenvolvedores Altamente Produtivos
zenorocha
1
590
What's new in the Liferay Community
zenorocha
0
740
Launching Liferay Projects Faster with WeDeploy
zenorocha
1
620
How Liferay fits into the real of latest technologies
zenorocha
0
680
Estoicismo e JavaScript
zenorocha
3
1.3k
Por que ninguém se importa com seu novo projeto open source?
zenorocha
2
1.2k
Como investir em... você!
zenorocha
1
640
Other Decks in Programming
See All in Programming
Dockerfile CMD for Node.js
grazie1999
0
110
Flow は今どうなっているか
mizdra
PRO
0
660
FDEが実現するAI駆動経営の現在地
gonta
2
290
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
350
「人を評価する AI」の設計と実装
ryoyanara
0
220
【デモ】Kiroで体験する仕様駆動開発|設計からコーディングまでAIと進める開発フロー
cmkudo
0
280
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
670
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
220
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
350
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
350
メールのエイリアス機能を履き違えない
isshinfunada
0
250
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
230
Featured
See All Featured
A designer walks into a library…
pauljervisheath
211
24k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
210
GitHub's CSS Performance
jonrohan
1033
470k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
370
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
440
The Curse of the Amulet
leimatthew05
2
14k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The Cult of Friendly URLs
andyhume
79
7k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
300
Transcript
None
I’m from Brazil!
None
None
None
None
None
None
None
the most famous client-side projects are fated to die
None
None
None
so you think everything will become “native" one day?
what the major web companies have been working on?
None
None
None
None
None
None
None
None
None
None
None
None
None
how do you create a “component” nowadays?
1. Never create! Just use a jQuery plugin
2. Copy and paste someone’s code
3. And hope it works
None
<html5-la>
<video is=”camera”> eduardolundgren.github.io/video-camera-element
None
None
<element name=“html5-la“ constructor="HTML5LA" attributes="where"> // content goes here </element> <element>
<element> <element name="camera" extends="video"> // content goes here </element>
None
using JS <html5-la></html5-la> var proto = Object.create(HTMLElement.prototype); proto.createdCallback = function()
{ this.textContent = ‘HTML5 LA!'; }; document.register(‘html5-la', { prototype: proto });
lifecycle • createdCallback() • enteredDocumentCallback() • leftDocumentCallback() • attributeChangedCallback()
None
None
how to use it? <polymer-element name=“html5-la" attributes="where"> <script> Polymer(‘html5-la', {
where: ‘Santa Monica’, created: function() { // do something } }); </script> </polymer-element>
lifecycle • created() • enteredView() • leftView() • attributeChanged()
None
Templates are reusable blocks of code
Templates are reusable blocks of code
None
None
attempt #1 <div id="template" style="display: none"> <img src="logo.png" class="logo.png"> </div>
<script id="template" type="text/x-handlebars-template"> <img src="logo.png"> </script> attempt #2
None
how to create it? <template id="myTemplate"> <img src=""> </template>
how to use it? // 1. Access template’s content var
t = document.querySelector('#myTemplate').content; // 2. Manipulate internal element t.querySelector('img').src = 'logo.png'; // 3. Clone and append in the DOM document.body.appendChild(t.cloneNode(true));
None
Shadow DOM hides the implementation details
what about <iframe>?
what’s a <video> made of? or password, textarea, date?
how to use it? <h1>Foo</h1> <div id=”elem”></div> var elem =
document.querySelector(‘#elem'); var elemShadowDOM = elem.createShadowRoot(); ! elemShadowDOM.innerHTML = '<h1>Bar</h1>';
markup, style & script encapsulated <h1>Foo</h1> <div id=”elem”></div> var elem
= document.querySelector(‘#elem'); var elemShadowDOM = elem.createShadowRoot(); ! elemShadowDOM.innerHTML = ‘<h1>Bar</h1>’ + ‘<style>h1 { color: red; }</style>’;
None
None
None
how to use it? <link rel="import" href="myelement.html">
None
None
None
None
where can I find them? NPM? Bower?
None
None
None
<twitter-button> zenorocha.github.io/twitter-button
<google-maps> eduardolundgren.github.io/google-maps-element
<video is=”camera”> eduardolundgren.github.io/video-camera-element
<video is=”tracking”> eduardolundgren.github.io/video-tracking-element
in other words…
encapsulation and code reuse for real
the best way to predict the future is to create
it
None
thanks! zenorocha.com