Back to the Future with Web Components

Almost every web developer has heard of web components; some have played with them; and a handful are deploying them to production. This talk aims to teach you about using web components: why they’re important, what’s different about using web components compared to other MVC-style solutions, and what rough patches we’ve hit landing web components to millions of users.

Works at Atlassian on their style guide and the UI library that implements it (AUI).

His message: you can start using web components today!

Demo: JC’s meme generator web component. “Y U NO PUT STRUCTURE IN DOM!” (bitbucket:jcreenaune/meme-or-die)

It’s all DOM. The structure, events and methods are all DOM.

So why would you do this stuff?

The raw markup of a library has a lot of boilerplate and code you can’t change. It’s nice to abstract that away so people just supply the information you actually need to supply to make things work; and to make the API clear.

[Aside: essentially web components are a universal templating option. Otherwise you need to build out a set for every stack that needs it.]

Web components spec is pretty huge – currently they’re just using Custom Elements.

Atlassian created skate.js (IE9+). They’re not providing an API to style the component, because that’s directly opposed to having a style guide.

So… what sucks about this stuff?

  • Client-side performance – a lot of Atlassian’s products have very big DOM views (think Bitbucket diff pages). They had to do heaps of optimisation.
  • Server-side rendering – still an unanswered question, SEO could be a problem
  • Trying to link the original API to the exploded component, eg. For ARIA attributes which need to use common IDs to link elements together.

Web components = separation of interface and implementation of HTML.