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
Web Components v1
Search
hemanth.hm
April 13, 2017
Programming
1
110
Web Components v1
Quick intro to Web Components v1
hemanth.hm
April 13, 2017
Tweet
Share
More Decks by hemanth.hm
See All by hemanth.hm
Rethink Async
gnumanth
1
88
Harmony with ES6!
gnumanth
6
1.2k
Ants and Algorithm
gnumanth
1
120
NoSQL?
gnumanth
1
250
Google's whitepaper
gnumanth
3
130
Python Intro
gnumanth
1
390
Other Decks in Programming
See All in Programming
AI Agentを利用したAndroid開発について
yuchan2215
0
170
TCAを用いたAmebaのリアーキテクチャ
dazy
0
260
[JAWS DAYS 2025] 最近の DB の競合解決の仕組みが分かった気になってみた
maroon1st
0
240
エンジニアに許された特別な時間の終わり
watany
85
73k
Boost Your Web Performance with Hyperdrive
chimame
1
210
機能が複雑化しても 頼りになる FactoryBotの話
tamikof
1
280
신입 안드로이드 개발자의 AI 스타트업 생존기 (+ Native C++ Code를 Android에서 사용해보기)
dygames
0
440
Webフレームワークとともに利用するWeb components / JSConf.jp おかわり
spring_raining
1
180
Your Architecture as a Crime Scene:Forensic Analysis @bastacon 2025 in Frankfurt
manfredsteyer
PRO
0
160
iOSでQRコード生成奮闘記
ktcryomm
2
190
はじめてのIssueOps - GitHub Actionsで実現するコメント駆動オペレーション
tmknom
7
2.1k
「その気にさせる」エンジニアが 最強のリーダーになる理由
gimupop
3
400
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Making the Leap to Tech Lead
cromwellryan
133
9.1k
Visualization
eitanlees
146
15k
Rails Girls Zürich Keynote
gr2m
94
13k
Side Projects
sachag
452
42k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Site-Speed That Sticks
csswizardry
4
430
How to Ace a Technical Interview
jacobian
276
23k
Building Your Own Lightsaber
phodgson
104
6.3k
The Language of Interfaces
destraynor
156
24k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
134
33k
Transcript
Web Componentes
· <template> tag · HTML imports · Shadow DOM ·
Custom Elements
<template>
'content' in document.createElement('template');
Activating <template>: var t = document.querySelector('#aweTemplate'); var clone = document.importNode(t.content,
true); document.body.appendChild(clone);
DEMO
HTML imports
'import' in document.createElement('link');
<link rel="import" href="/imports/aweTemplate.html"> <link rel="import" href="/imports/aweTemplate.html" onload="handleLoad(event)" onerror="handleError(event)">
const link = document.querySelector('link[rel=import]'); const xkcd = link.import; // Access
DOM of the document in aweTemplate const cartoon = xkcd.querySelector('img');
const aweDoc = document.currentScript.ownerDocument;
DEMO
Shadow DOM
const supportsShadowDOMV1 = !!HTMLElement.prototype.attachShadow;
const host = document.body.createShadowRoot(); host.innerHTML = "<p>I'm a <em>shadow</em> dom!</p>";
document.appendChild(host);
DEMO
Custom Elements
const supportsCustomElements = 'customElements' in window;
class AweElement extends HTMLElement {...} window.customElements.define('awe-element', AppDrawer);
window.customElements.define('awe-element', class extends HTMLElement {...});
class AweElement extends HTMLElement { constructor() { super(); // Don't
forget ... } connectedCallback() { ... } disconnectedCallback() { ... } attributeChangedCallback(attrName, oldVal, newVal) { ... } }
None
DEMO
None
None
h3manth.com @gnumanth
None