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
Zeno Rocha
December 17, 2013
Programming
4.3k
27
Share
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
700
7 Habits of Highly Productive Developers
zenorocha
1
440
7 Hábitos de Desenvolvedores Altamente Produtivos
zenorocha
1
570
What's new in the Liferay Community
zenorocha
0
730
Launching Liferay Projects Faster with WeDeploy
zenorocha
1
610
How Liferay fits into the real of latest technologies
zenorocha
0
670
Estoicismo e JavaScript
zenorocha
3
1.2k
Por que ninguém se importa com seu novo projeto open source?
zenorocha
2
1.2k
Como investir em... você!
zenorocha
1
610
Other Decks in Programming
See All in Programming
継続的な負荷検証を目指して
pyama86
3
1k
20年以上続くプロダクトでも使い続けられる静的解析ツールを求めて
matsuo_atsushi
0
140
GitHubCopilotCLIをはじめよう.pdf
htkym
0
330
クラウドネイティブなエンジニアに向ける Raycastの魅力と実際の活用事例
nealle
2
250
20260514_its_the_context_window_stupid.pdf
heita
0
840
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
4
500
Agent Skills を社内で育てる仕組み作り
jackchuka
1
1.8k
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.2k
実用!Hono RPC2026
yodaka
2
310
Explore CoroutineScope
tomoeng11
0
180
いつか誰かが、と思っていた フロントエンド刷新5年間の実践知
kiichisugihara
1
260
Back to the roots of date
jinroq
0
780
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
560
How to build a perfect <img>
jonoalderson
1
5.5k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
160
For a Future-Friendly Web
brad_frost
183
10k
The untapped power of vector embeddings
frankvandijk
2
1.7k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
150
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
10k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.6k
Code Review Best Practice
trishagee
74
20k
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