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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
hemanth.hm
April 13, 2017
Programming
1
130
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
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
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
3
1.6k
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
170
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
15
3k
「やめとこ」がなくなった — 1月にZennを始めて22本書いた AI共創開発のリアル
atani14
0
370
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
2.2k
モジュラモノリスにおける境界をGoのinternalパッケージで守る
magavel
0
3.5k
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
140
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
420
How to stabilize UI tests using XCTest
akkeylab
0
110
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
15
8.5k
Railsの気持ちを考えながらコントローラとビューを整頓する/tidying-rails-controllers-and-views-as-rails-think
moro
5
390
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
380
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
760
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
140
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
The SEO identity crisis: Don't let AI make you average
varn
0
410
The Spectacular Lies of Maps
axbom
PRO
1
610
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
380
GraphQLとの向き合い方2022年版
quramy
50
14k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
150
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.7k
How to build a perfect <img>
jonoalderson
1
5.2k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
270
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