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
CLI ツールを Go ライブラリ として再実装する理由 / Why reimplement a CLI tool as a Go library
ktr_0731
3
1k
Jakarta EE Meets AI
ivargrimstad
0
620
decksh - a little language for decks
ajstarks
4
21k
Constant integer division faster than compiler-generated code
herumi
2
460
大規模FlutterプロジェクトのCI実行時間を約8割削減した話
teamlab
PRO
0
450
대규모 트래픽을 처리하는 프론트 개발자의 전략
maryang
0
120
AI Ramen Fight
yusukebe
0
130
Vibe Codingの幻想を超えて-生成AIを現場で使えるようにするまでの泥臭い話.ai
fumiyakume
21
10k
PHPUnitの限界をPlaywrightで補完するテストアプローチ
yuzneri
0
390
AIコーディングエージェント全社導入とセキュリティ対策
hikaruegashira
16
9.5k
令和最新版手のひらコンピュータ
koba789
13
6.2k
Terraform やるなら公式スタイルガイドを読もう 〜重要項目 10選〜
hiyanger
12
2.9k
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
8
550
Become a Pro
speakerdeck
PRO
29
5.5k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
800
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
131
19k
Code Reviewing Like a Champion
maltzj
524
40k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
Gamification - CAS2011
davidbonilla
81
5.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
1k
RailsConf 2023
tenderlove
30
1.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
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