$30 off During Our Annual Pro Sale. View Details »
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
120
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
110
Harmony with ES6!
gnumanth
6
1.2k
Ants and Algorithm
gnumanth
1
130
NoSQL?
gnumanth
2
260
Google's whitepaper
gnumanth
3
150
Python Intro
gnumanth
1
390
Other Decks in Programming
See All in Programming
Cap'n Webについて
yusukebe
0
120
WebRTC と Rust と8K 60fps
tnoho
2
1.9k
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
5
2k
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
360
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
140
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
120
生成AIを利用するだけでなく、投資できる組織へ
pospome
0
240
sbt 2
xuwei_k
0
260
ゲームの物理 剛体編
fadis
0
320
React Native New Architecture 移行実践報告
taminif
1
150
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
6
2.1k
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
2
650
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
2.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
The Cost Of JavaScript in 2023
addyosmani
55
9.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Fireside Chat
paigeccino
41
3.7k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
Navigating Team Friction
lara
191
16k
A better future with KSS
kneath
240
18k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Side Projects
sachag
455
43k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
93
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