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
100
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
85
Harmony with ES6!
gnumanth
6
1.2k
Ants and Algorithm
gnumanth
1
110
NoSQL?
gnumanth
1
240
Google's whitepaper
gnumanth
3
130
Python Intro
gnumanth
1
380
Other Decks in Programming
See All in Programming
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
540
ドメインイベント増えすぎ問題
h0r15h0
2
300
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
770
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
240
From Translations to Multi Dimension Entities
alexanderschranz
2
130
採用事例の少ないSvelteを選んだ理由と それを正解にするためにやっていること
oekazuma
2
1k
Jakarta EE meets AI
ivargrimstad
0
240
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
110
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
return文におけるstd::moveについて
onihusube
1
1.1k
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
A Tale of Four Properties
chriscoyier
157
23k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
How to Ace a Technical Interview
jacobian
276
23k
Scaling GitHub
holman
458
140k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
YesSQL, Process and Tooling at Scale
rocio
169
14k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
The Cost Of JavaScript in 2023
addyosmani
45
7k
A designer walks into a library…
pauljervisheath
204
24k
For a Future-Friendly Web
brad_frost
175
9.4k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.3k
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