Thoughts on Web Components...
A couple of weeks ago, I attended the 2014 Chrome Dev Summit at Google HQ. It was a good opportunity to get a one-day whirlwind tour of a number of upcoming technologies that are changing the way web applications are built in very significant ways.
I had briefly read about Web Components before, but hadn’t gone into too much depth because the lack of broad browser support at the time had made it an impractical choice to do anything real with. I also distinctly remember that the first time I read about it, the use of custom elements had made me somewhat uncomfortable; maybe it was the purist in me that made me feel like they were somehow “polluting” the “standard” HTML markup that we have come to know and love for so long.
But then, as I sat through Dmitri Glazkov’s excellent presentation at the Summit, I became fairly convinced that Web Components are, indeed, a significant and much-needed step forward for web application development. If you, too, are on the fence, I highly recommend watching the talk to see why it changed my mind. Weighing in at just 25 minutes, it’s a fairly succinct (and entertaining) look at how the four parts of Web Components - Custom Elements, HTML Imports, Templates, and the Shadow DOM - make effective code reuse and composition possible on the web.
For me, the use of the Shadow DOM to allow reusable components to be isolated is the most interesting aspect. This three part series of posts on HTML5Rocks provides a great introduction to how it works, and what it makes possible.
Now that browser support for Web Components (without the use of polyfills) is growing, I plan to spend more time digging deeper into how I can start taking advantage of these new capabilities to build sensibly structured and maintainable web applications.