SlideShare a Scribd company logo
1 of 36
Web Components
with Polymer
Jeff Tapper
Digital Primates
@jefftapper / @digitalprimates
Who am I?
• Senior Consultant at Digital Primates
– Building next generation client applications
• Developing Internet applications for 20 years
• Author of 12 books on Internet technologies
Who are you?
What are Web Components?
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>
How do they work
• Web Components are a combination of
several w3c specifications
• Custom Elements
• Templates
• Shadow Dom
• HTML Imports
Creating Custom Elements
• Pure JavaScript
• X-tags: framework developed by Mozilla
• Polymer: framework developed by Google
• Each provides lifecycle events you can use
Creating in JavaScript
<my-tag></my-tag>
var proto = Object.create(HTMLElement.prototype);
proto.createdCallback = function (){
this.textContent = 'This is my tag';
};
document.register('my-tag',{prototype:proto});
Component Lifecycle
• createdCallback()
• attachedCallback()
• detachedCallback()
• attributeChangedCallback()
X-tags
xtag.register('x-frankenstein', {
lifecycle:{
created: function(){
alert("Look! It's moving. It's alive!");
}
}
});
Xtags Lifecycle Events
• created
• inserted
• removed
• attributeChanged
Polymer
<polymer-element name="say-hi">
<script>
Polymer('say-hi',{
whatToSay: 'Hi',
created: function(){
// do something
}
})
</polymer-element>
Polymer Lifecycle Events
• created
• attached
• detached
• attributeChanged
What is Polymer?
A library built on top of Web Components.
Allows us to use Web Components today in modern browsers
which don’t yet support Web Components
3 main pieces
• A set of polyfills
• Web application framework
• Set of UI components
What are we covering?
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?
Life on the Edge
Web Components are beyond leading edge.
As of this moment, they do not work in their entirety in all
browsers
A good portion of the functionality is available in Chrome
So, is it real?
Yes!!!
Web Component support is actually here today. Even
though they are not fully supported in all browsers,
Polymer and Polyfills allow use in most modern
browsers today
Where can I use this today?
Always finding the latest and greatest
http://jonrimmer.github.io/are-we-
componentized-yet/
Why are they important?
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
Ease of Distribution
Appropriate technology choices
• Markup in markup, not in code
How do they work?
Web Components are a series of Working draft
specifications:
• HTML Templates
– http://www.w3.org/TR/html-templates/
• Shadow DOM
– http://www.w3.org/TR/shadow-dom/
• Custom Elements
– http://www.w3.org/TR/custom-elements/
• HTML Imports
– http://www.w3.org/TR/html-imports/
Example Application
• Twitter-button
created by Zeno Rocha
source code available at
https://github.com/social-elements/twitter-button
http://localhost/poly/twitter-button-master
• Language Application
created by Michael Labriola
http://localhost/poly/
Templates
The concept of templates is prolific and nearly self-
explanatory. Their use takes a bit more effort:
Inactive DOM Fragment
Easily Clone-able
Easily Change-able
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.
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
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
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.
Styles
Outside styles don’t
affect shadow content
Styles defined in here
are scoped locally
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:
<polymer-element extends="button" name="fancy-button">
</polymer-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.
Resources
• http://www.w3.org/wiki/WebComponents/
• http://www.polymer-project.org/
• @polymer – officical twitter of the polymer
project
• @digitalprimates
• @jefftapper

More Related Content

What's hot

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
 
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 and Modular CSS
Web Components and Modular CSSWeb Components and Modular CSS
Web Components and Modular CSSAndrew Rota
 
Google Polymer Introduction
Google Polymer IntroductionGoogle Polymer Introduction
Google Polymer IntroductionDavid Price
 
Web Components Everywhere
Web Components EverywhereWeb Components Everywhere
Web Components EverywhereIlia Idakiev
 
Web components the future is here
Web components   the future is hereWeb components   the future is here
Web components the future is hereGil Fink
 
Building a Secure App with Google Polymer and Java / Spring
Building a Secure App with Google Polymer and Java / SpringBuilding a Secure App with Google Polymer and Java / Spring
Building a Secure App with Google Polymer and Java / Springsdeeg
 
Polymer
Polymer Polymer
Polymer jskvara
 
Razor into the Razor'verse
Razor into the Razor'verseRazor into the Razor'verse
Razor into the Razor'verseEd Charbeneau
 
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
 
Goodbye JavaScript Hello Blazor
Goodbye JavaScript Hello BlazorGoodbye JavaScript Hello Blazor
Goodbye JavaScript Hello BlazorEd Charbeneau
 
Polymer - Welcome to the Future @ PyGrunn 08/07/2014
Polymer - Welcome to the Future @ PyGrunn 08/07/2014Polymer - Welcome to the Future @ PyGrunn 08/07/2014
Polymer - Welcome to the Future @ PyGrunn 08/07/2014Spyros Ioakeimidis
 
Web components
Web componentsWeb components
Web componentsGil Fink
 
Polymer / WebComponents
Polymer / WebComponentsPolymer / WebComponents
Polymer / WebComponentsArnaud Kervern
 
The Truth About Your Web App's Performance
The Truth About Your Web App's PerformanceThe Truth About Your Web App's Performance
The Truth About Your Web App's PerformanceJohn Riviello
 

What's hot (20)

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
 
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
 
Polymer
PolymerPolymer
Polymer
 
Introduction to polymer project
Introduction to polymer projectIntroduction to polymer project
Introduction to polymer project
 
Web Components and Modular CSS
Web Components and Modular CSSWeb Components and Modular CSS
Web Components and Modular CSS
 
Google Polymer Introduction
Google Polymer IntroductionGoogle Polymer Introduction
Google Polymer Introduction
 
Booting up with polymer
Booting up with polymerBooting up with polymer
Booting up with polymer
 
Web Components Everywhere
Web Components EverywhereWeb Components Everywhere
Web Components Everywhere
 
Web components the future is here
Web components   the future is hereWeb components   the future is here
Web components the future is here
 
Building a Secure App with Google Polymer and Java / Spring
Building a Secure App with Google Polymer and Java / SpringBuilding a Secure App with Google Polymer and Java / Spring
Building a Secure App with Google Polymer and Java / Spring
 
Polymer
Polymer Polymer
Polymer
 
Razor into the Razor'verse
Razor into the Razor'verseRazor into the Razor'verse
Razor into the Razor'verse
 
Google Polymer Framework
Google Polymer FrameworkGoogle Polymer Framework
Google Polymer Framework
 
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
 
Goodbye JavaScript Hello Blazor
Goodbye JavaScript Hello BlazorGoodbye JavaScript Hello Blazor
Goodbye JavaScript Hello Blazor
 
Polymer - Welcome to the Future @ PyGrunn 08/07/2014
Polymer - Welcome to the Future @ PyGrunn 08/07/2014Polymer - Welcome to the Future @ PyGrunn 08/07/2014
Polymer - Welcome to the Future @ PyGrunn 08/07/2014
 
Web components
Web componentsWeb components
Web components
 
Polymer / WebComponents
Polymer / WebComponentsPolymer / WebComponents
Polymer / WebComponents
 
The Truth About Your Web App's Performance
The Truth About Your Web App's PerformanceThe Truth About Your Web App's Performance
The Truth About Your Web App's Performance
 

Viewers also liked

Lego for Software Engineers at Silicon Valley Code Camp 2011 (2010-10-10)
Lego for Software Engineers at Silicon Valley Code Camp 2011 (2010-10-10)Lego for Software Engineers at Silicon Valley Code Camp 2011 (2010-10-10)
Lego for Software Engineers at Silicon Valley Code Camp 2011 (2010-10-10)Theo Jungeblut
 
An Introduction to Web Components
An Introduction to Web ComponentsAn Introduction to Web Components
An Introduction to Web ComponentsRed Pill Now
 
Gamify Your Life – My Epic Quest of Awesome - Eric Boyd
Gamify Your Life – My Epic Quest of Awesome - Eric BoydGamify Your Life – My Epic Quest of Awesome - Eric Boyd
Gamify Your Life – My Epic Quest of Awesome - Eric BoydFITC
 
Your UX is not my UX
Your UX is not my UXYour UX is not my UX
Your UX is not my UXFITC
 
Just Make Stuff!
Just Make Stuff!Just Make Stuff!
Just Make Stuff!FITC
 
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.Goofy, Goodfellas and a Gardener: The Masters of Experience Design.
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.FITC
 
Programming Play
Programming PlayProgramming Play
Programming PlayFITC
 
The Power of Play in Experimental Design with Claudia Chagüi De León
The Power of Play in Experimental Design with Claudia Chagüi De LeónThe Power of Play in Experimental Design with Claudia Chagüi De León
The Power of Play in Experimental Design with Claudia Chagüi De LeónFITC
 
Here Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript DebuggingHere Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript DebuggingFITC
 
Managing Responsive Design Projects
Managing Responsive Design ProjectsManaging Responsive Design Projects
Managing Responsive Design ProjectsFITC
 
When Clients Bare it All with David Allen
When Clients Bare it All with David AllenWhen Clients Bare it All with David Allen
When Clients Bare it All with David AllenFITC
 
Creating a Smile Worthy World
Creating a Smile Worthy WorldCreating a Smile Worthy World
Creating a Smile Worthy WorldFITC
 
How to SURVIVE the Creative Industry
How to SURVIVE the Creative IndustryHow to SURVIVE the Creative Industry
How to SURVIVE the Creative IndustryFITC
 
I HATE YOUR GAME with Bob Heubel
I HATE YOUR GAME with Bob HeubelI HATE YOUR GAME with Bob Heubel
I HATE YOUR GAME with Bob HeubelFITC
 
The Shifting Nature of FED Role
The Shifting Nature of FED RoleThe Shifting Nature of FED Role
The Shifting Nature of FED RoleFITC
 
! or ? with Chip Kidd
! or ? with Chip Kidd! or ? with Chip Kidd
! or ? with Chip KiddFITC
 
Putting your Passion into the Details
Putting your Passion into the DetailsPutting your Passion into the Details
Putting your Passion into the DetailsFITC
 
Empowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris MillsEmpowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris MillsFITC
 
Customizing Your Process
Customizing Your ProcessCustomizing Your Process
Customizing Your ProcessFITC
 

Viewers also liked (20)

Lego for Software Engineers at Silicon Valley Code Camp 2011 (2010-10-10)
Lego for Software Engineers at Silicon Valley Code Camp 2011 (2010-10-10)Lego for Software Engineers at Silicon Valley Code Camp 2011 (2010-10-10)
Lego for Software Engineers at Silicon Valley Code Camp 2011 (2010-10-10)
 
HTML5 Web Components
HTML5 Web ComponentsHTML5 Web Components
HTML5 Web Components
 
An Introduction to Web Components
An Introduction to Web ComponentsAn Introduction to Web Components
An Introduction to Web Components
 
Gamify Your Life – My Epic Quest of Awesome - Eric Boyd
Gamify Your Life – My Epic Quest of Awesome - Eric BoydGamify Your Life – My Epic Quest of Awesome - Eric Boyd
Gamify Your Life – My Epic Quest of Awesome - Eric Boyd
 
Your UX is not my UX
Your UX is not my UXYour UX is not my UX
Your UX is not my UX
 
Just Make Stuff!
Just Make Stuff!Just Make Stuff!
Just Make Stuff!
 
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.Goofy, Goodfellas and a Gardener: The Masters of Experience Design.
Goofy, Goodfellas and a Gardener: The Masters of Experience Design.
 
Programming Play
Programming PlayProgramming Play
Programming Play
 
The Power of Play in Experimental Design with Claudia Chagüi De León
The Power of Play in Experimental Design with Claudia Chagüi De LeónThe Power of Play in Experimental Design with Claudia Chagüi De León
The Power of Play in Experimental Design with Claudia Chagüi De León
 
Here Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript DebuggingHere Be Dragons – Advanced JavaScript Debugging
Here Be Dragons – Advanced JavaScript Debugging
 
Managing Responsive Design Projects
Managing Responsive Design ProjectsManaging Responsive Design Projects
Managing Responsive Design Projects
 
When Clients Bare it All with David Allen
When Clients Bare it All with David AllenWhen Clients Bare it All with David Allen
When Clients Bare it All with David Allen
 
Creating a Smile Worthy World
Creating a Smile Worthy WorldCreating a Smile Worthy World
Creating a Smile Worthy World
 
How to SURVIVE the Creative Industry
How to SURVIVE the Creative IndustryHow to SURVIVE the Creative Industry
How to SURVIVE the Creative Industry
 
I HATE YOUR GAME with Bob Heubel
I HATE YOUR GAME with Bob HeubelI HATE YOUR GAME with Bob Heubel
I HATE YOUR GAME with Bob Heubel
 
The Shifting Nature of FED Role
The Shifting Nature of FED RoleThe Shifting Nature of FED Role
The Shifting Nature of FED Role
 
! or ? with Chip Kidd
! or ? with Chip Kidd! or ? with Chip Kidd
! or ? with Chip Kidd
 
Putting your Passion into the Details
Putting your Passion into the DetailsPutting your Passion into the Details
Putting your Passion into the Details
 
Empowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris MillsEmpowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris Mills
 
Customizing Your Process
Customizing Your ProcessCustomizing Your Process
Customizing Your Process
 

Similar to Web Components

Web components, so close!
Web components, so close!Web components, so close!
Web components, so close!Aleks Zinevych
 
The Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedThe Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedGil Fink
 
Web component driven development
Web component driven developmentWeb component driven development
Web component driven developmentGil Fink
 
02 From HTML tags to XHTML
02 From HTML tags to XHTML02 From HTML tags to XHTML
02 From HTML tags to XHTMLRich Dron
 
Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21Chris Danford
 
Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Mikael Svenson
 
Web Components - The Future is Here
Web Components - The Future is HereWeb Components - The Future is Here
Web Components - The Future is HereGil Fink
 
Delhi student's day
Delhi student's dayDelhi student's day
Delhi student's dayAnkur Mishra
 
Webcomponents TLV October 2014
Webcomponents TLV October 2014Webcomponents TLV October 2014
Webcomponents TLV October 2014Dmitry Bakaleinik
 
Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyImplementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyMarcos Labad
 
Introduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS InteractiveIntroduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS InteractiveJohn Riviello
 
Web components - The Future is Here
Web components - The Future is HereWeb components - The Future is Here
Web components - The Future is HereGil Fink
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedGil Fink
 
Introduction to Web Components & Polymer Workshop - U of I WebCon
Introduction to Web Components & Polymer Workshop - U of I WebConIntroduction to Web Components & Polymer Workshop - U of I WebCon
Introduction to Web Components & Polymer Workshop - U of I WebConJohn Riviello
 
Web components
Web componentsWeb components
Web componentsMohd Saeed
 
Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...Marios Fakiolas
 
Ensuring Design Standards with Web Components
Ensuring Design Standards with Web ComponentsEnsuring Design Standards with Web Components
Ensuring Design Standards with Web ComponentsJohn Riviello
 

Similar to Web Components (20)

Web components, so close!
Web components, so close!Web components, so close!
Web components, so close!
 
The Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedThe Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has Arrived
 
Web component driven development
Web component driven developmentWeb component driven development
Web component driven development
 
Html,CSS & UI/UX design
Html,CSS & UI/UX designHtml,CSS & UI/UX design
Html,CSS & UI/UX design
 
02 From HTML tags to XHTML
02 From HTML tags to XHTML02 From HTML tags to XHTML
02 From HTML tags to XHTML
 
Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21
 
Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013
 
Web Components - The Future is Here
Web Components - The Future is HereWeb Components - The Future is Here
Web Components - The Future is Here
 
Delhi student's day
Delhi student's dayDelhi student's day
Delhi student's day
 
Webcomponents TLV October 2014
Webcomponents TLV October 2014Webcomponents TLV October 2014
Webcomponents TLV October 2014
 
Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyImplementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing Company
 
Introduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS InteractiveIntroduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS Interactive
 
Web components - The Future is Here
Web components - The Future is HereWeb components - The Future is Here
Web components - The Future is Here
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrived
 
Introduction to Web Components & Polymer Workshop - U of I WebCon
Introduction to Web Components & Polymer Workshop - U of I WebConIntroduction to Web Components & Polymer Workshop - U of I WebCon
Introduction to Web Components & Polymer Workshop - U of I WebCon
 
Webcomponents v2
Webcomponents v2Webcomponents v2
Webcomponents v2
 
Web components
Web componentsWeb components
Web components
 
Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...
 
Fundamentals of HTML5
Fundamentals of HTML5Fundamentals of HTML5
Fundamentals of HTML5
 
Ensuring Design Standards with Web Components
Ensuring Design Standards with Web ComponentsEnsuring Design Standards with Web Components
Ensuring Design Standards with Web Components
 

More from 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
 

More from 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
 

Recently uploaded

Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneCall girls in Ahmedabad High profile
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Roomdivyansh0kumar0
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Deliverybabeytanya
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In South Ex 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In South Ex 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 

Web Components

  • 1. Web Components with Polymer Jeff Tapper Digital Primates @jefftapper / @digitalprimates
  • 2. Who am I? • Senior Consultant at Digital Primates – Building next generation client applications • Developing Internet applications for 20 years • Author of 12 books on Internet technologies
  • 4. What are Web Components? 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>
  • 5. How do they work • Web Components are a combination of several w3c specifications • Custom Elements • Templates • Shadow Dom • HTML Imports
  • 6. Creating Custom Elements • Pure JavaScript • X-tags: framework developed by Mozilla • Polymer: framework developed by Google • Each provides lifecycle events you can use
  • 7. Creating in JavaScript <my-tag></my-tag> var proto = Object.create(HTMLElement.prototype); proto.createdCallback = function (){ this.textContent = 'This is my tag'; }; document.register('my-tag',{prototype:proto});
  • 8. Component Lifecycle • createdCallback() • attachedCallback() • detachedCallback() • attributeChangedCallback()
  • 10. Xtags Lifecycle Events • created • inserted • removed • attributeChanged
  • 12. Polymer Lifecycle Events • created • attached • detached • attributeChanged
  • 13. What is Polymer? A library built on top of Web Components. Allows us to use Web Components today in modern browsers which don’t yet support Web Components 3 main pieces • A set of polyfills • Web application framework • Set of UI components
  • 14. What are we covering? 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?
  • 15. Life on the Edge Web Components are beyond leading edge. As of this moment, they do not work in their entirety in all browsers A good portion of the functionality is available in Chrome
  • 16. So, is it real? Yes!!! Web Component support is actually here today. Even though they are not fully supported in all browsers, Polymer and Polyfills allow use in most modern browsers today
  • 17. Where can I use this today?
  • 18. Always finding the latest and greatest http://jonrimmer.github.io/are-we- componentized-yet/
  • 19. Why are they important? 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 Ease of Distribution Appropriate technology choices • Markup in markup, not in code
  • 20. How do they work? Web Components are a series of Working draft specifications: • HTML Templates – http://www.w3.org/TR/html-templates/ • Shadow DOM – http://www.w3.org/TR/shadow-dom/ • Custom Elements – http://www.w3.org/TR/custom-elements/ • HTML Imports – http://www.w3.org/TR/html-imports/
  • 21. Example Application • Twitter-button created by Zeno Rocha source code available at https://github.com/social-elements/twitter-button http://localhost/poly/twitter-button-master • Language Application created by Michael Labriola http://localhost/poly/
  • 22. Templates The concept of templates is prolific and nearly self- explanatory. Their use takes a bit more effort: Inactive DOM Fragment Easily Clone-able Easily Change-able
  • 23. 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.
  • 24. 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
  • 25. 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
  • 26. Shadow DOM The browser sees this: Photo by Photo by: Mark Kaelin/TechRepublic
  • 29. The Shadow also forms a boundary. Styles don’t cross unless you let them. So you to keep control of this area Styles
  • 30. This, by default, goes both ways… meaning we aren’t worried about collisions. Styles Outside styles don’t affect shadow content Styles defined in here are scoped locally
  • 31. 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">
  • 32. 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.
  • 33. 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
  • 34. Custom Elements • Defining a custom element like this: <polymer-element extends="button" name="fancy-button"> </polymer-element> • Allows you to use that custom element in your own markup: <div> <fancy-button></fancy-button> </div>
  • 35. 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.
  • 36. Resources • http://www.w3.org/wiki/WebComponents/ • http://www.polymer-project.org/ • @polymer – officical twitter of the polymer project • @digitalprimates • @jefftapper