Thursday, September 13, 2012

Fun With Web Components 1

Fun With Web Components 1

Web Components is an exciting new feature that enables developers to consume and author reusable elements. Imagine hiding away all the <div> wrappers, styles and javascript we write to create custom widgets, such as suggest boxes and accordions, into separate and encapsulated components using native browser capabilities. 

A great video on Web Components is here.

Ingredients

Setting up is a piece of cake

  1. Enable Shadow DOM and <style scoped="scoped">
  2. Go to chrome://flags/
  3. Enable Shadow DOM and <style scoped>
  4. Copy the project to your web server and load up one of the example pages in Web-Components-Polyfill/samples
Now to experiment...