SlideShare una empresa de Scribd logo
1 de 36
Page 0 of 59

Reaching for the Future With
Web Components and Polymer

Michael Labriola - @mlabriola
Senior Consultant w/ Digital Primates
Web Components
Put simply, Web Components are an attempt to let you write
custom components that can be used like this:
<body>
Sales:<br>
<my-super-cool-chart id="coolChart">
</ my-super-cool-chart >
</body>
What in the world is Polymer?
A library built on top of Web Components.
Allows us to use Web Components today in modern
browsers
3 main pieces
• A set of polyfills
• Web application framework
• Set of UI components
What are we going to cover?
Web Components, specifically:
What in the world are web components?
What problem are they trying to solve?
How do they work?
Can I actually use these things?
What does it mean to my app/development process?
Bleeding Edge
Web Components are beyond leading edge.
As of this moment, they do not work in their entirety in
any browser
A good portion of the functionality is available in Chrome
Canary if you turn on all of the experimental WebKit and
JavaScript features
Why am I talking about this?
I do believe web components are a significant part of our
future
I think understand their goal and vision is crucial to the next
few years
I think they will change a lot before they are final
...and?
You can still play with flavors of Web Components to a large
extent through polyfills today
Unless you skydive to work or love framework code more
than sleep, you may want to avoid putting this all into
production today
Given that... Why Components?
A few minor reasons you may like the idea, first:
Encapsulation
•
•
•
•

Manageable Reuse
Hiding complexity and implementation
Dealing with duplicated IDs
Dealing with CSS scoping / propagation
Why?
And then:
[More] even playing field
• Using the same tricks the browser uses

Ease of distribution
Appropriate technology uses
• Markup in markup not strings or code
How do they work?
Web Components are a draft specification, but they rely on
a number of other puzzle pieces, including:
Templates
Decorators
Shadow DOM
Imports
Custom Elements
Templates
The concept of templates is prolific and nearly selfexplanatory. Their use takes a bit more effort:
Inactive DOM Fragment
Easily Clone-able
Easily Change-able
State of the Intersection
People use templates today, they tend to take on two forms,
first:
<div id="productTemplate" style="display:none">
<img src="/images/products/{{product_id}}.png">
<div class="name"></div>
<div class="description"></div>
</div>
The Reality
Which, as Eric Bidelman of Google nicely points out:
Is good, because were are creating markup in markup and
working with the DOM
Is bad, because its active DOM, so the image still tries to
load on startup
•

404 (Not Found)
http://localhost/images/products/%7B%7Bproduct_id%7D%7D.png

Is bad, because either we deal with global styles for these
things or we have to scope all of our styles manually and
deal with collisions
State of the Intersection
Second form, we use strings:
<script id="productTemplate" type="text/x-template">
<img src="/images/products/{{product_id}}.png">
<div class="name"></div>
<div class="description"></div>
</script>

OR
template = "<div> 
<img  src="/images/products/{{product_id}}.png"> 
<div class="name"></div> 
<div class="description"></div> 
</div>";
The Reality
Which makes me sad…
•String parsing
•No real way to do validation
•Especially if stored remotely, is a great way to open
yourself up to attacks
Built In Templates
You define them with the template element
<template id="productTemplate">
<div>
<img src="">
<div class="name"></div>
<div class="description"></div>
</div>
</template>

This is parsed but it’s not active. It’s not rendered.
Using It

DEMO, if you will
Decorators
Decorators are the next concept in the web component
stack but…
“Decorators, unlike other parts of Web Components, do not have a
specification yet.” –W3C
…so, lets go ahead and skip these for today.
Shadow DOM
Shadow DOM is at the heart of the whole component
concepts
It’s encapsulation.
Its used by the browsers today to implement their own
controls
Ultimately its about hiding implementation details and
exposing an interface… music to my ears
Shadow DOM
The name and the technical explanation sometimes get in
the way of the concept.
Put simply, the user sees this:

Photo by Photo by: Mark Kaelin/TechRepublic
Shadow DOM
The browser sees this:

Photo by Photo by: Mark Kaelin/TechRepublic
Shadow Host/Root
Rendering
Styles
The Shadow also forms a boundary. Styles don’t cross
unless you let them. So you to keep control of this area
Styles
This, by default, goes both ways… meaning we aren’t
worried about collisions.

Outside styles don’t
affect shadow content

Styles defined in here
are scoped locally
Shadow DOM Demo

Another DEMO, please
HTML Imports
HTML imports are about importing and sharing HTML
content.
Why? Well, reuse, it facilitates the reuse of templates
and provides us a fundamental need if we are going
to share an encapsulated chunk we might call a
component.
<link rel="import" href="goodies.html">
HTML Imports
Last word on this…
Imports aren’t supported pretty much anywhere yet,
however, there are polyfills.
Imports are blocking. So, your page will act as though
it needs this content before it can render.
Custom Elements
Elements are the key to putting this together.
Custom Elements are DOM elements that can be
defined by a developer.
They are allowed to manage state and provide a
scriptable interface.
In other words, they are the shell of what will become
our component
Custom Elements
Defining a custom element like this:
<element extends="button" name="fancy-button">
</element>

Allows you to use that custom element in your own markup:
<div>
<fancy-button></fancy-button>
</div>
Custom Elements
You can use the concepts we previously discussed,
templates, Shadow DOM, etc. from within a custom
element.
Further, custom elements give you a set of Lifecycle
callbacks so you can know things like when you are inserted
into the DOM, removed and ready.
This means you can define the visual aspects of a custom
element in mark up and the code in script.
Custom Element in Script
You can also register custom elements in script directly
using:
document.register( 'option-group' );

Which turns out to be a really convenient thing because…
Reality Check
Most of this doesn’t work at all.
More specifically, the <element> approach to building your
custom elements doesn’t work yet.
In fact, it seems to have left Chrome Canary for the
moment.
Light, tunnel, something
This is where Polymer and other polyfills (such as x-tags)
come in
They let us play today and give feedback for tomorrow
Please remember, this is pre-alpha software
In the meantime… explore
http://www.polymer-project.org/
http://www.x-tags.org/
http://www.w3.org/TR/2013/WD-components-intro20130606/
Page 0 of 59

Reaching for the Future With
Web Components and Polymer

Michael Labriola - @mlabriola
Senior Consultant w/ Digital Primates

Más contenido relacionado

La actualidad más candente

Levent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerLevent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerErik Isaksen
 
Google Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkGoogle Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkImam Raza
 
Web components the future is here
Web components   the future is hereWeb components   the future is here
Web components the future is hereGil Fink
 
Polymer
Polymer Polymer
Polymer jskvara
 
How to build a web application with Polymer
How to build a web application with PolymerHow to build a web application with Polymer
How to build a web application with PolymerSami Suo-Heikki
 
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17GreeceJS
 
Web components
Web componentsWeb components
Web componentsGil Fink
 
Build Reusable Web Components using HTML5 Web cComponents
Build Reusable Web Components using HTML5 Web cComponentsBuild Reusable Web Components using HTML5 Web cComponents
Build Reusable Web Components using HTML5 Web cComponentsGil Fink
 
Polymer vs other libraries (Devfest Ukraine 2015)
Polymer vs other libraries (Devfest Ukraine 2015)Polymer vs other libraries (Devfest Ukraine 2015)
Polymer vs other libraries (Devfest Ukraine 2015)jskvara
 
DHTML - Dynamic HTML
DHTML - Dynamic HTMLDHTML - Dynamic HTML
DHTML - Dynamic HTMLReem Alattas
 
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationWeb Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationAndrew Rota
 
Web components - An Introduction
Web components - An IntroductionWeb components - An Introduction
Web components - An Introductioncherukumilli2
 
Custom Elements with Polymer Web Components #econfpsu16
Custom Elements with Polymer Web Components #econfpsu16Custom Elements with Polymer Web Components #econfpsu16
Custom Elements with Polymer Web Components #econfpsu16John Riviello
 
Web components, so close!
Web components, so close!Web components, so close!
Web components, so close!Aleks Zinevych
 
Polymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill LibraryPolymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill Librarynaohito maeda
 
HTML5, CSS3, and JavaScript
HTML5, CSS3, and JavaScriptHTML5, CSS3, and JavaScript
HTML5, CSS3, and JavaScriptZac Gordon
 
Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Hendrik Ebbers
 

La actualidad más candente (20)

Levent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & PolymerLevent-Gurses' Introduction to Web Components & Polymer
Levent-Gurses' Introduction to Web Components & Polymer
 
Google Polymer Framework
Google Polymer FrameworkGoogle Polymer Framework
Google Polymer Framework
 
Google Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkGoogle Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talk
 
Web components the future is here
Web components   the future is hereWeb components   the future is here
Web components the future is here
 
Polymer
PolymerPolymer
Polymer
 
Polymer
Polymer Polymer
Polymer
 
How to build a web application with Polymer
How to build a web application with PolymerHow to build a web application with Polymer
How to build a web application with Polymer
 
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
 
Introduction to polymer project
Introduction to polymer projectIntroduction to polymer project
Introduction to polymer project
 
Web components
Web componentsWeb components
Web components
 
Build Reusable Web Components using HTML5 Web cComponents
Build Reusable Web Components using HTML5 Web cComponentsBuild Reusable Web Components using HTML5 Web cComponents
Build Reusable Web Components using HTML5 Web cComponents
 
Polymer vs other libraries (Devfest Ukraine 2015)
Polymer vs other libraries (Devfest Ukraine 2015)Polymer vs other libraries (Devfest Ukraine 2015)
Polymer vs other libraries (Devfest Ukraine 2015)
 
DHTML - Dynamic HTML
DHTML - Dynamic HTMLDHTML - Dynamic HTML
DHTML - Dynamic HTML
 
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationWeb Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing Combination
 
Web components - An Introduction
Web components - An IntroductionWeb components - An Introduction
Web components - An Introduction
 
Custom Elements with Polymer Web Components #econfpsu16
Custom Elements with Polymer Web Components #econfpsu16Custom Elements with Polymer Web Components #econfpsu16
Custom Elements with Polymer Web Components #econfpsu16
 
Web components, so close!
Web components, so close!Web components, so close!
Web components, so close!
 
Polymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill LibraryPolymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill Library
 
HTML5, CSS3, and JavaScript
HTML5, CSS3, and JavaScriptHTML5, CSS3, and JavaScript
HTML5, CSS3, and JavaScript
 
Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)Web Components & Polymer 1.0 (Webinale Berlin)
Web Components & Polymer 1.0 (Webinale Berlin)
 

Similar a Reaching for the Future with Web Components and Polymer

Web Components: back to the future
Web Components: back to the futureWeb Components: back to the future
Web Components: back to the futureDA-14
 
KharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address themKharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address themVlad Fedosov
 
BreizhBeans - Web components
BreizhBeans - Web componentsBreizhBeans - Web components
BreizhBeans - Web componentsHoracio Gonzalez
 
Angular View Encapsulation
Angular View EncapsulationAngular View Encapsulation
Angular View EncapsulationJennifer Estrada
 
Webcomponents TLV October 2014
Webcomponents TLV October 2014Webcomponents TLV October 2014
Webcomponents TLV October 2014Dmitry Bakaleinik
 
Polymer-Powered Design Systems - DevFest Florida
Polymer-Powered Design Systems - DevFest FloridaPolymer-Powered Design Systems - DevFest Florida
Polymer-Powered Design Systems - DevFest FloridaJohn Riviello
 
Web components
Web componentsWeb components
Web componentsMohd Saeed
 
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationIBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationDevelopment Seed
 
Yeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsYeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsclimboid
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistMark Fayngersh
 
How To Express Your Creative Self With Windows Presentation Foundation And Si...
How To Express Your Creative Self With Windows Presentation Foundation And Si...How To Express Your Creative Self With Windows Presentation Foundation And Si...
How To Express Your Creative Self With Windows Presentation Foundation And Si...guest83d3e0
 
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...Horacio Gonzalez
 
Polymer - Lego for the web!
Polymer - Lego for the web!Polymer - Lego for the web!
Polymer - Lego for the web!Codemotion
 
Iasi code camp 12 october 2013 shadow dom - mihai bîrsan
Iasi code camp 12 october 2013   shadow dom - mihai bîrsanIasi code camp 12 october 2013   shadow dom - mihai bîrsan
Iasi code camp 12 october 2013 shadow dom - mihai bîrsanCodecamp Romania
 
Visualizing Content with Display Suite
Visualizing Content with Display SuiteVisualizing Content with Display Suite
Visualizing Content with Display SuiteMatthias Vandermaesen
 
LvivCSS: Web Components as a foundation for Design System
LvivCSS: Web Components as a foundation for Design SystemLvivCSS: Web Components as a foundation for Design System
LvivCSS: Web Components as a foundation for Design SystemVlad Fedosov
 

Similar a Reaching for the Future with Web Components and Polymer (20)

Webcomponents v2
Webcomponents v2Webcomponents v2
Webcomponents v2
 
Web Components: back to the future
Web Components: back to the futureWeb Components: back to the future
Web Components: back to the future
 
KharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address themKharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address them
 
BreizhBeans - Web components
BreizhBeans - Web componentsBreizhBeans - Web components
BreizhBeans - Web components
 
Angular View Encapsulation
Angular View EncapsulationAngular View Encapsulation
Angular View Encapsulation
 
Webcomponents TLV October 2014
Webcomponents TLV October 2014Webcomponents TLV October 2014
Webcomponents TLV October 2014
 
Polymer-Powered Design Systems - DevFest Florida
Polymer-Powered Design Systems - DevFest FloridaPolymer-Powered Design Systems - DevFest Florida
Polymer-Powered Design Systems - DevFest Florida
 
Web components
Web componentsWeb components
Web components
 
Web components
Web componentsWeb components
Web components
 
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationIBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
 
Yeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsYeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web apps
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
 
How To Express Your Creative Self With Windows Presentation Foundation And Si...
How To Express Your Creative Self With Windows Presentation Foundation And Si...How To Express Your Creative Self With Windows Presentation Foundation And Si...
How To Express Your Creative Self With Windows Presentation Foundation And Si...
 
ASP.NET MVC3 RAD
ASP.NET MVC3 RADASP.NET MVC3 RAD
ASP.NET MVC3 RAD
 
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
 
Polymer - Lego for the web!
Polymer - Lego for the web!Polymer - Lego for the web!
Polymer - Lego for the web!
 
Iasi code camp 12 october 2013 shadow dom - mihai bîrsan
Iasi code camp 12 october 2013   shadow dom - mihai bîrsanIasi code camp 12 october 2013   shadow dom - mihai bîrsan
Iasi code camp 12 october 2013 shadow dom - mihai bîrsan
 
Drupal distribution
Drupal distributionDrupal distribution
Drupal distribution
 
Visualizing Content with Display Suite
Visualizing Content with Display SuiteVisualizing Content with Display Suite
Visualizing Content with Display Suite
 
LvivCSS: Web Components as a foundation for Design System
LvivCSS: Web Components as a foundation for Design SystemLvivCSS: Web Components as a foundation for Design System
LvivCSS: Web Components as a foundation for Design System
 

Más de FITC

Cut it up
Cut it upCut it up
Cut it upFITC
 
Designing for Digital Health
Designing for Digital HealthDesigning for Digital Health
Designing for Digital HealthFITC
 
Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript PerformanceFITC
 
Surviving Your Tech Stack
Surviving Your Tech StackSurviving Your Tech Stack
Surviving Your Tech StackFITC
 
How to Pitch Your First AR Project
How to Pitch Your First AR ProjectHow to Pitch Your First AR Project
How to Pitch Your First AR ProjectFITC
 
Start by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerStart by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerFITC
 
Cocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryCocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryFITC
 
Everyday Innovation
Everyday InnovationEveryday Innovation
Everyday InnovationFITC
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight WebsitesFITC
 
Everything is Terrifying
Everything is TerrifyingEverything is Terrifying
Everything is TerrifyingFITC
 
Post-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanPost-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanFITC
 
The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)FITC
 
East of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameEast of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameFITC
 
Creating a Proactive Healthcare System
Creating a Proactive Healthcare SystemCreating a Proactive Healthcare System
Creating a Proactive Healthcare SystemFITC
 
World Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignWorld Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignFITC
 
The Power of Now
The Power of NowThe Power of Now
The Power of NowFITC
 
High Performance PWAs
High Performance PWAsHigh Performance PWAs
High Performance PWAsFITC
 
Rise of the JAMstack
Rise of the JAMstackRise of the JAMstack
Rise of the JAMstackFITC
 
From Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFrom Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFITC
 
Projects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForProjects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForFITC
 

Más de FITC (20)

Cut it up
Cut it upCut it up
Cut it up
 
Designing for Digital Health
Designing for Digital HealthDesigning for Digital Health
Designing for Digital Health
 
Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript Performance
 
Surviving Your Tech Stack
Surviving Your Tech StackSurviving Your Tech Stack
Surviving Your Tech Stack
 
How to Pitch Your First AR Project
How to Pitch Your First AR ProjectHow to Pitch Your First AR Project
How to Pitch Your First AR Project
 
Start by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerStart by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the Answer
 
Cocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryCocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s Story
 
Everyday Innovation
Everyday InnovationEveryday Innovation
Everyday Innovation
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight Websites
 
Everything is Terrifying
Everything is TerrifyingEverything is Terrifying
Everything is Terrifying
 
Post-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanPost-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future Human
 
The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)
 
East of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameEast of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR Game
 
Creating a Proactive Healthcare System
Creating a Proactive Healthcare SystemCreating a Proactive Healthcare System
Creating a Proactive Healthcare System
 
World Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignWorld Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product Design
 
The Power of Now
The Power of NowThe Power of Now
The Power of Now
 
High Performance PWAs
High Performance PWAsHigh Performance PWAs
High Performance PWAs
 
Rise of the JAMstack
Rise of the JAMstackRise of the JAMstack
Rise of the JAMstack
 
From Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFrom Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self Discovery
 
Projects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForProjects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time For
 

Último

Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...kajalverma014
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftAanSulistiyo
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxgalaxypingy
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样ayvbos
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsMonica Sydney
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样ayvbos
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Roommeghakumariji156
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoilmeghakumariji156
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查ydyuyu
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptxAsmae Rabhi
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdfMatthew Sinclair
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfJOHNBEBONYAP1
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasDigicorns Technologies
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsMonica Sydney
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制pxcywzqs
 

Último (20)

Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 

Reaching for the Future with Web Components and Polymer

  • 1. Page 0 of 59 Reaching for the Future With Web Components and Polymer Michael Labriola - @mlabriola Senior Consultant w/ Digital Primates
  • 2. Web Components Put simply, Web Components are an attempt to let you write custom components that can be used like this: <body> Sales:<br> <my-super-cool-chart id="coolChart"> </ my-super-cool-chart > </body>
  • 3. What in the world is Polymer? A library built on top of Web Components. Allows us to use Web Components today in modern browsers 3 main pieces • A set of polyfills • Web application framework • Set of UI components
  • 4. What are we going to cover? Web Components, specifically: What in the world are web components? What problem are they trying to solve? How do they work? Can I actually use these things? What does it mean to my app/development process?
  • 5. Bleeding Edge Web Components are beyond leading edge. As of this moment, they do not work in their entirety in any browser A good portion of the functionality is available in Chrome Canary if you turn on all of the experimental WebKit and JavaScript features
  • 6. Why am I talking about this? I do believe web components are a significant part of our future I think understand their goal and vision is crucial to the next few years I think they will change a lot before they are final
  • 7. ...and? You can still play with flavors of Web Components to a large extent through polyfills today Unless you skydive to work or love framework code more than sleep, you may want to avoid putting this all into production today
  • 8. Given that... Why Components? A few minor reasons you may like the idea, first: Encapsulation • • • • Manageable Reuse Hiding complexity and implementation Dealing with duplicated IDs Dealing with CSS scoping / propagation
  • 9. Why? And then: [More] even playing field • Using the same tricks the browser uses Ease of distribution Appropriate technology uses • Markup in markup not strings or code
  • 10. How do they work? Web Components are a draft specification, but they rely on a number of other puzzle pieces, including: Templates Decorators Shadow DOM Imports Custom Elements
  • 11. Templates The concept of templates is prolific and nearly selfexplanatory. Their use takes a bit more effort: Inactive DOM Fragment Easily Clone-able Easily Change-able
  • 12. State of the Intersection People use templates today, they tend to take on two forms, first: <div id="productTemplate" style="display:none"> <img src="/images/products/{{product_id}}.png"> <div class="name"></div> <div class="description"></div> </div>
  • 13. The Reality Which, as Eric Bidelman of Google nicely points out: Is good, because were are creating markup in markup and working with the DOM Is bad, because its active DOM, so the image still tries to load on startup • 404 (Not Found) http://localhost/images/products/%7B%7Bproduct_id%7D%7D.png Is bad, because either we deal with global styles for these things or we have to scope all of our styles manually and deal with collisions
  • 14. State of the Intersection Second form, we use strings: <script id="productTemplate" type="text/x-template"> <img src="/images/products/{{product_id}}.png"> <div class="name"></div> <div class="description"></div> </script> OR template = "<div> <img src="/images/products/{{product_id}}.png"> <div class="name"></div> <div class="description"></div> </div>";
  • 15. The Reality Which makes me sad… •String parsing •No real way to do validation •Especially if stored remotely, is a great way to open yourself up to attacks
  • 16. Built In Templates You define them with the template element <template id="productTemplate"> <div> <img src=""> <div class="name"></div> <div class="description"></div> </div> </template> This is parsed but it’s not active. It’s not rendered.
  • 17. Using It DEMO, if you will
  • 18. Decorators Decorators are the next concept in the web component stack but… “Decorators, unlike other parts of Web Components, do not have a specification yet.” –W3C …so, lets go ahead and skip these for today.
  • 19. Shadow DOM Shadow DOM is at the heart of the whole component concepts It’s encapsulation. Its used by the browsers today to implement their own controls Ultimately its about hiding implementation details and exposing an interface… music to my ears
  • 20. Shadow DOM The name and the technical explanation sometimes get in the way of the concept. Put simply, the user sees this: Photo by Photo by: Mark Kaelin/TechRepublic
  • 21. Shadow DOM The browser sees this: Photo by Photo by: Mark Kaelin/TechRepublic
  • 24. Styles The Shadow also forms a boundary. Styles don’t cross unless you let them. So you to keep control of this area
  • 25. Styles This, by default, goes both ways… meaning we aren’t worried about collisions. Outside styles don’t affect shadow content Styles defined in here are scoped locally
  • 26. Shadow DOM Demo Another DEMO, please
  • 27. HTML Imports HTML imports are about importing and sharing HTML content. Why? Well, reuse, it facilitates the reuse of templates and provides us a fundamental need if we are going to share an encapsulated chunk we might call a component. <link rel="import" href="goodies.html">
  • 28. HTML Imports Last word on this… Imports aren’t supported pretty much anywhere yet, however, there are polyfills. Imports are blocking. So, your page will act as though it needs this content before it can render.
  • 29. Custom Elements Elements are the key to putting this together. Custom Elements are DOM elements that can be defined by a developer. They are allowed to manage state and provide a scriptable interface. In other words, they are the shell of what will become our component
  • 30. Custom Elements Defining a custom element like this: <element extends="button" name="fancy-button"> </element> Allows you to use that custom element in your own markup: <div> <fancy-button></fancy-button> </div>
  • 31. Custom Elements You can use the concepts we previously discussed, templates, Shadow DOM, etc. from within a custom element. Further, custom elements give you a set of Lifecycle callbacks so you can know things like when you are inserted into the DOM, removed and ready. This means you can define the visual aspects of a custom element in mark up and the code in script.
  • 32. Custom Element in Script You can also register custom elements in script directly using: document.register( 'option-group' ); Which turns out to be a really convenient thing because…
  • 33. Reality Check Most of this doesn’t work at all. More specifically, the <element> approach to building your custom elements doesn’t work yet. In fact, it seems to have left Chrome Canary for the moment.
  • 34. Light, tunnel, something This is where Polymer and other polyfills (such as x-tags) come in They let us play today and give feedback for tomorrow Please remember, this is pre-alpha software
  • 35. In the meantime… explore http://www.polymer-project.org/ http://www.x-tags.org/ http://www.w3.org/TR/2013/WD-components-intro20130606/
  • 36. Page 0 of 59 Reaching for the Future With Web Components and Polymer Michael Labriola - @mlabriola Senior Consultant w/ Digital Primates