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
距離関数を極める! / SESSIONS 2024
gam0022
0
300
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
260
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
650
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
150
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
Missing parts when designing and implementing Android UI
ericksli
0
190
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
Outline View in SwiftUI
1024jp
1
340
受け取る人から提供する人になるということ
little_rubyist
0
250
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
260
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
970
DevTools extensions で 独自の DevTool を開発する | FlutterKaigi 2024
kokiyoshida
0
120
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
A better future with KSS
kneath
238
17k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Navigating Team Friction
lara
183
14k
Faster Mobile Websites
deanohume
305
30k
Site-Speed That Sticks
csswizardry
0
36
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
KATA
mclloyd
29
14k
How GitHub (no longer) Works
holman
310
140k
Ruby is Unlike a Banana
tanoku
97
11k
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