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
O mágico mundo de Web Components
Search
Mateus Ortiz
June 26, 2014
Programming
2
230
O mágico mundo de Web Components
Present at beltrao In Tech
Mateus Ortiz
June 26, 2014
Tweet
Share
More Decks by Mateus Ortiz
See All by Mateus Ortiz
O maravilhoso mundo do front-end... não
mateusortiz
0
140
Desbravando Web Components
mateusortiz
0
69
Web Components: é o Futuro?
mateusortiz
2
190
Other Decks in Programming
See All in Programming
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1.1k
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.4k
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
120
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
220
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
550
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
220
Ruby x Terminal
a_matsuda
7
600
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
290
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
240
クライアントワークでSREをするということ。あるいは事業会社におけるSREと同じこと・違うこと
nnaka2992
1
340
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
250
OTP を自動で入力する裏技
megabitsenmzq
0
110
Featured
See All Featured
A Tale of Four Properties
chriscoyier
163
24k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
170
The Curse of the Amulet
leimatthew05
1
10k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
260
How Software Deployment tools have changed in the past 20 years
geshan
0
33k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
How GitHub (no longer) Works
holman
316
140k
Everyday Curiosity
cassininazir
0
160
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
220
How to Think Like a Performance Engineer
csswizardry
28
2.5k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
390
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
100
Transcript
O Mágico Mundo De Web Components @mteusortiz
@mteusortiz /mateusortiz Front-End Developer
None
None
Web Components
HTML5 é o Futuro?
None
O Futuro
None
<x-heart> http://mateusortiz.github.io/x-heart/
None
Web Components Shadow DOM Template Custom Elements HTML Imports Decorators
Custom Elements
Antes com <element> <element name="x-button" constructor="XBUTTON" attributes="lg sm xs"> <!--
Content --> </element>
Antes com <element> <element name="x-button" extends="button"> <!-- Content --> </element>
http://goo.gl/GWatuU
com JS <my-widget></my-widget> var WidgetProto = Object.create(HTMLElement.prototype); ! WidgetProto.createdCallback =
function() { this.textContent = "BeltraoInTech"; }; ! var Widget = document.registerElement('my-widget', { prototype: WidgetProto });
Lifecycle Callbacks createdCallback(); attachedCallback(); detachedCallback(); attributeChangedCallback();
Funciona no IE6
None
t polymer-project.org
t x-tags.org
W3C standards platform polyfills Template shadow dom HTML Imports Custom
Elements
Com Polymer <polymer-element name="x-button" attributes="color"> <script> Polymer('x-button', { color: 'red',
created: function() { // ... } }); </script> </polymer-element>
Lifecycle Callbacks Polymer created(); detached(); attributeChanged(); attached();
Template
Templates são pedaços inertes de DOM que podem ser reutilizados.
# GAMBIARRA existe vários Templates para server- side e client-side
<template>
como criar? <template> <p>BeltraoInTech...</p> <img src="beltrao.png"/> </template>
como usar? var tmpl = document.querySelector("#template"); tmpl.content.querySelector("img").src = "dog.gif"; document.body.appendChild(tmpl.content.cloneNode(true));
Shadow DOM
O SHADOW DOM encapsula STYLE e MARCAÇÃO.
<iframe>
Shadow Dom é a mesma tecnologia usada pelos fabricantes de
navegadores para implemetar as tags como <video> e <textarea>.
None
t mas voltaram atrás
exemplo Shadow Dom <div class="widget"></div> var host = document.querySelector(".widget"); var
root = host.createShadowRoot(); root.innerHTML = "<h1>Estou dentro da div</h1>";
Encapsula style, marcação e script
HTML Imports
t importações carregar documentos externos em nossa página.
HTML Import <link rel="import" href="beltra-tech.html">
None
Obrigado TWITTER.COM/MTEUSORTIZ GITHUB.COM/MATEUSORTIZ