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
130
1
Share
Web Components v1
Quick intro to Web Components v1
hemanth.hm
April 13, 2017
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
20260320登壇資料
pharct
0
150
Java 21/25 Virtual Threads 소개
debop
0
320
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
3
440
実践ハーネスエンジニアリング #MOSHTech
kajitack
7
5.4k
事業会社でのセキュリティ長期インターンについて
masachikaura
0
210
一度始めたらやめられない開発効率向上術 / Findy あなたのdotfilesを教えて!
k0kubun
3
2.7k
20260315 AWSなんもわからん🥲
chiilog
2
180
AIと共にエンジニアとPMの “二刀流”を実現する
naruogram
0
120
Coding at the Speed of Thought: The New Era of Symfony Docker
dunglas
0
4.2k
Rethinking API Platform Filters
vinceamstoutz
0
5.3k
ネイティブアプリとWebフロントエンドのAPI通信ラッパーにおける共通化の勘所
suguruooki
0
230
RSAが破られる前に知っておきたい 耐量子計算機暗号(PQC)入門 / Intro to PQC: Preparing for the Post-RSA Era
mackey0225
3
110
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
320
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
340
Documentation Writing (for coders)
carmenintech
77
5.3k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.4k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
4 Signs Your Business is Dying
shpigford
187
22k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
140
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Ruling the World: When Life Gets Gamed
codingconduct
0
190
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