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
WebComponents LT at AQ
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Yoshihiro Iwanaga
August 29, 2013
Programming
66
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WebComponents LT at AQ
Yoshihiro Iwanaga
August 29, 2013
More Decks by Yoshihiro Iwanaga
See All by Yoshihiro Iwanaga
HTTP2 最速実装v2
yoshi
0
130
JavaScript と Arduino でオリジナルデバイスを作ろう
yoshi
0
90
Anomaly Detection by Mean and Standard Deviation
yoshi
0
180
MHTML LT at AQ
yoshi
2
57
HOTATE (Developers Summit 2012)
yoshi
0
36
Anomaly detection using correlations of load
yoshi
0
58
Other Decks in Programming
See All in Programming
net-httpのHTTP/2対応について
naruse
0
480
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
540
3Dシーンの圧縮
fadis
1
770
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
140
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
260
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
3
1.3k
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
100
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
5.8k
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
570
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.1k
New "Type" system on PicoRuby
pocke
1
920
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
120
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.9k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
390
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
540
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
250
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
71
40k
Embracing the Ebb and Flow
colly
88
5.1k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
350
Music & Morning Musume
bryan
47
7.2k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Transcript
WebComponents iwanaga
Who am I Working at Twitter bot @quake_alert @quake_alert_en Yoshihiro
Iwanaga
What is WebComponents? Provides mechanism for the declaration of markup
prototype. (W3C Working Draft) Makes reusing and composing HTML components much easier J
None
None
The component model for the WebComponents 1. Templates 2. Decorators
3. Custom Elements 4. Shadow DOM 5. Imports
Templates <template id="t"> <div> <h2>デフォルトテキスト</h2> <figure> <img alt="image"> <figcaption>キャプション</figcaption> <button>イイネ!</button>
</figure> </div> </template>
insert template to DOM var t = document.getElementById('t'); var clone
= t.content.cloneNode(true); clone.querySelector('h2').textContent = 'テキスト'; clone.querySelector('img').src = 'image.png'; clone.querySelector('figcaption').textContent = 'キャプション'; document.body.appendChild(clone); <template id="t"> <div> <h2>デフォルトテキスト</h2> <figure> <img alt="image"> <figcaption>キャプション</figcaption> <button>イイネ!</button> </figure> </div> </template>
demo
Shadow DOM Establishes functional boundaries in document tree. Document tree
boundary Shadow tree
Shadow DOM <div id="target"></div> <script> document.addEventListener("DOMContentLoaded", function(){ /* not supported
*/ //var shadow = document.getElementById("target”) .createShadowRoot(); /* deprecated. Webkit Only */ //var shadow = new WebKitShadowRoot( document.getElementById("target")); /* Webkit Only */ var shadow = document.getElementById("target") .webkitCreateShadowRoot(); shadow.innerHTML = '<h2>this is shadow tree</h2>' + '<img src="image.jpg">'; }, false); </script>
demo
Wait !! How is the Style inheritance?
<script> document.addEventListener("DOMContentLoaded", function(){ /* not supported */ //var shadow =
document.getElementById("target”) .createShadowRoot(); /* Webkit Only */ var shadow = document.getElementById("target") .webkitCreateShadowRoot(); /* resetStyleInheritance */ shadow.resetStyleInheritance = true; shadow.innerHTML = '<h2>this is shadow tree</h2>' + '<img src="image.jpg">'; }, false); </script> Preventing the CSS inheritance
demo
How is the browser compatibility?
Browser Compatibility lol
Frameworks J http://www.polymer-project.org/ Polymer Brick http://mozilla.github.io/brick/
Thanks @quake_alert! @quake_alert_en please follow