Tomek Wytrębowicz
<template>
<template>
What's New in Shadow DOM v1 (by examples) hayato.io/2016/shadowdomv1/ by Hayato Ito - spec editor, Chromium dev
V0 | V1 |
---|---|
|
+
|
|
|
|
Multiple shadow roots per element - not supported |
Fallback content - not supported |
|
What's New in Shadow DOM v1 (by examples) hayato.io/2016/shadowdomv1/ by Hayato Ito - spec editor
V0 | V1 |
---|---|
|
|
|
Deprecated |
becomes a scope of sequential focus navigation.
|
|
new methods and utilities: slot.assignedNodes(), Element.assignedSlot, Node.isConnected, Node.getRootNode(options)
|
Reintroducing Custom Elements V1 webreflection.co.uk/blog/2016/08/21/custom-elements-v1 by Andrea Giammarchi - author of CEv1 polyfill
V0 | V1 |
---|---|
|
|
|
|
V0 | V1 |
---|---|
|
Doing any DOM related changes in constructor are strongly discouraged!
|
|
|
observed every attribute
|
observes only attributes declated in
|
is="v1"
is
in V1is
(<dom-bind>
)
1.7->Hybrid->2.0
Hybrid should work with 1.7, 2.0, v0 and v1
document-register-elementshould make v0 & v1 run side by side
Editor’s Draft, 13 December 2016
# my-element's Shadow DOM
<style>
:host{
--my-element-title-color: red;
}
.title {
color: var(--my-element-title-color);
}
</style>
<h3 class="title">I'm a .title from Shadow DOM</h3>
<style>
.some-class{
--my-element-title-color: blue;
}
</style>
<my-element class="some-class"></my-element>
@apply
A Collection of Interesting Ideas, 18 September 2016
Polymer claims WDtabatkins.github.io/specs/css-apply-rule/
:root,
.scope,
my-element{
--my-button: {
min-width: 5.14em;
margin: 0 0.29em;
/* any rules */
padding: 0.7em 0.57em;
@apply --shadow-elevation-2dp;
};
}
/* my-element Shadow DOM*/
.button {
@apply --my-button;
}
::part()
idea in W3C WebPlatform WG
github.com/w3c/webcomponents/issues/300
<date-range-selector>
<!-- #shadow-root -->
<div id="container">
<input part="start-date" id="start-date" type="date">
</div>
<!-- /shadow-root -->
</date-range-selector>
date-range-selector::part(start-date){
/* normal styles */
}
idea at W3C WebPlatform WG issues
is
issueclass FooBarAttr {
attachedCallback() {
console.log('was created for first time');
}
changedCallback(newValue, oldValue) {
console.log('it changed');
}
}
customAttributes.define('foo-bar', FooBarAttr);
THE Way to create layouts
See my presenation from Meet.js Summit 2016
.fb-layout {
display: grid;
grid: "head head" 3em
"nav subnav" auto
"nav main" 1fr
"foot foot"
/ 5em 1fr;
}
.grid {
display: grid;
grid-template-columns: repeat(12, 1fr);
}
![]() |
✓ | |
![]() |
✓ | |
![]() |
✓ | |
✓ | ||
![]() |
• | ⚑ behind the flag |
• | Old spec supported for years. "High priority" for upgrade |
Tomek Wytrębowicz
tomalec
@tomalecpl
Specs:
Template (HTML5.1)- www.w3.org/TR/html51
Shadow DOM - w3c.github.io/webcomponents/spec/shadow/
Custom Elements - w3c.github.io/webcomponents/spec/custom/
HTML Imports - w3c.github.io/webcomponents/spec/imports/
Other:
is
related issue at W3C - github.com/w3c/webcomponents/issues/509
This & other talks: