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
130
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
160
Python Intro
gnumanth
1
400
Other Decks in Programming
See All in Programming
AHC061解説
shun_pi
0
410
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
130
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
130
「やめとこ」がなくなった — 1月にZennを始めて22本書いた AI共創開発のリアル
atani14
0
410
Claude Codeログ基盤の構築
giginet
PRO
7
3.5k
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
200
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
2.6k
Codex の「自走力」を高める
yorifuji
0
1.3k
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
150
maplibre-gl-layers - 地図に移動体たくさん表示したい
kekyo
PRO
0
380
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
170
モダンOBSプラグイン開発
umireon
0
170
Featured
See All Featured
Designing for Timeless Needs
cassininazir
0
170
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
830
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Believing is Seeing
oripsolob
1
89
Code Review Best Practice
trishagee
74
20k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
160
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
500
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
250
Abbi's Birthday
coloredviolet
2
5.5k
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