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
Yoshihiro Iwanaga
August 29, 2013
Programming
68
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
140
JavaScript と Arduino でオリジナルデバイスを作ろう
yoshi
0
91
Anomaly Detection by Mean and Standard Deviation
yoshi
0
180
MHTML LT at AQ
yoshi
2
59
HOTATE (Developers Summit 2012)
yoshi
0
38
Anomaly detection using correlations of load
yoshi
0
60
Other Decks in Programming
See All in Programming
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
110
生成AI導入の「期待外れ」を乗り越える ー 開発フロー改革が目指す、真の組織変革
starfish719
0
4.4k
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
850
170k Jobs a Day on GKE: Scaling Mercari's CI Platform - and What's Next for AI-Native Development
junyaokabe
0
110
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
660
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
550
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
430
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
1.7k
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
580
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
480
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
120
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
480
Featured
See All Featured
Design in an AI World
tapps
1
280
Code Reviewing Like a Champion
maltzj
528
40k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
25k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
490
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.8k
ラッコキーワード サービス紹介資料
rakko
1
4.3M
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
240
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.2k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
430
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