WEB COMPONENT
&
GOOGLE POLYMER
Romain Linsolas
- Société Générale
- Java & Web developper
-
- @romaintaz
- https://github.com/linsolas
- http://linsolas.github.io
- Devoxx, Devoxx France, SoftShake...
- Brown Bag Lunch
<!--> <!DOCTYPE> <a> <abbr> <acronym> <address> <applet> <area> <article> <aside> <audio> <b> <base> <basefont> <bdi> <bdo> <big> <blockquote> <body> <br> <button> <canvas> <caption> <center> <cite> <code> <col> <colgroup> <datalist> <dd> <del> <details> <dfn> <dialog> <dir> <div> <dl> <dt> <em> <embed> <fieldset> <figcaption> <figure> <font> <footer> <form> <frame> <frameset> <head> <header> <hgroup> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <html> <i> <iframe> <img> <input> <ins> <kbd> <keygen> <label> <legend> <li> <link> <main> <map> <mark> <menu> <menuitem> <meta> <meter> <nav> <noframes> <noscript> <object> <ol> <optgroup> <option> <output> <p> <param> <pre> <progress> <q> <rp> <rt> <ruby> <s> <samp> <script> <section> <select> <small> <source> <span> <strike> <strong> <style> <sub> <summary> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <time> <title> <tr> <track> <tt> <u> <ul> <var> <video> <wbr>
HTML 5, it's:
- 124 elements
- 32 new elements
- 12 deprecated elements
A tab component with Twitter Bootstrap
<div class="tab-content">
<div class="tab-pane active" id="home">...</div>
<div class="tab-pane" id="profile">...</div>
<div class="tab-pane" id="messages">...</div>
<div class="tab-pane" id="settings">...</div>
</div>
A better solution
<tabs-panel active="home">
<tab id="home">...</tab>
<tab id="profile">...</tab>
<tab id="messages">...</tab>
<tab id="settings">...</tab>
</tabs-panel>
A Twitter post
<blockquote class="twitter-tweet" lang="fr">
<p>If only Bradley's arm was longer. Best photo ever.
<a href="https://twitter.com/search?q=%23oscars&src=hash">#oscars</a>
<a href="http://t.co/C9U5NOtGap">pic.twitter.com/C9U5NOtGap</a>
</p> - Ellen DeGeneres (@TheEllenShow)
<a href="https://twitter.com/TheEllenShow/statuses/440322224407314432">3 Mars 2014</a>
</blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
Again, a better solution
<twitter-post tweetId="440322224407314432"></twitter-post>
Creation of a Web Component
Google Polymer
http://www.polymer-project.org/
<super-hero></super-hero>
Marvel Rest API
http://gateway.marvel.com/v1/public/characters/1009368?apikey=***
{ ...,
{
"id": 1009368,
"name": "Iron Man",
"description": "Wounded, captured and forced...",
"modified": "2013-11-07T10:55:38-0500",
"thumbnail": {
"path": "http://i.annihil.us/u/prod/marvel/i/mg/9/c0/527bb7b37ff55",
"extension": "jpg"
},
"resourceURI": "http://gateway.marvel.com/v1/public/characters/1009368",
"comics": { ...
- yo Project scaffolder
- bower Dependencies manager
- grunt Tasks executor
About the Web Component standard
The Web component is a standard... based on others standards
- Template
- Custom Elements
- Shadow DOM
- HTML Imports
- Decorators (not yet a standard)
Solution? Use polyfills
- A polyfill is a piece of code (or plugin) that provides the technology that you, the developer, expect the browser to provide natively.
Platform
https://github.com/Polymer/platform
Alternatives to
Google Polymer
Alternatives to Google Polymer
- Mozilla X-Tag
- IBM Delite
- https://github.com/ibm-js/delite
- Bosonic
- http://bosonic.github.io/
- "Vanilla" JS
...in fact, not yet!
- Standards in progress
- Polymer - or alternatives - still in beta
- Browser compatibility
-
- "Evergreen" browsers
- Internet Explorer 9 / 10+
Resources
- http://www.polymer-project.org/
- http://www.w3.org/TR/components-intro/
- http://developer.marvel.com/
- https://github.com/linsolas/devoxx-polymer
Some interesting websites
- http://webcomponents.org/
- http://webcomponents.org/polyfills/
- http://customelements.io/
https://github.com/linsolas/polymer-presentation