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
100
Harmony with ES6!
gnumanth
6
1.2k
Ants and Algorithm
gnumanth
1
130
NoSQL?
gnumanth
2
260
Google's whitepaper
gnumanth
3
140
Python Intro
gnumanth
1
390
Other Decks in Programming
See All in Programming
Node-REDのノードの開発・活用事例とコミュニティとの関わり(Node-RED Con Nagoya 2025)
404background
0
120
Vue 3.6 時代のリアクティビティ最前線 〜Vapor/alien-signals の実践とパフォーマンス最適化〜
hiranuma
2
410
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
610
Temporal Knowledge Graphで作る! 時間変化するナレッジを扱うAI Agentの世界
po3rin
5
1.3k
ノーコードからの脱出 -地獄のデスロード- / Escape from Base44
keisuke69
0
660
AIのバカさ加減に怒る前にやっておくこと
blueeventhorizon
0
160
ビルドプロセスをデバッグしよう!
yt8492
0
270
開発生産性が組織文化になるまでの軌跡
tonegawa07
0
100
What’s Fair is FAIR: A Decentralised Future for WordPress Distribution
rmccue
0
140
Flutterアプリ運用の現場で役立った監視Tips 5選
ostk0069
1
110
CSC305 Lecture 13
javiergs
PRO
0
410
MCPサーバー「モディフィウス」で変更容易性の向上をスケールする / modifius
minodriven
7
1.3k
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
80
6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
Optimizing for Happiness
mojombo
379
70k
The World Runs on Bad Software
bkeepers
PRO
72
12k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
10
920
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.8k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
970
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
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