Web components test
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.5.2/webcomponents.js"></script>
<test-elem>1</test-elem>
<test-elem>2</test-elem>
<test-elem>3</test-elem>
JavaScript
//see
// https://github.com/webcomponents/webcomponentsjs
// http://webcomponents.org/
// https://w3c.github.io/webcomponents/spec/custom/
// https://w3c.github.io/webcomponents/spec/shadow/
// https://w3c.github.io/webcomponents/spec/imports/
// http://habrahabr.ru/post/180377/ -shadow dom
// http://habrahabr.ru/post/152001/ -введение в веб компоненты
// http://habrahabr.ru/post/237421/ -polymer
var proto = Object.create(HTMLElement.prototype);
proto.createdCallback = function() {
console.log("createdCallback");
var div = document.createElement("div")
//var parent = this.parentNode;
//parent.removeChild(this);
};
document.registerElement('test-elem', {
prototype: proto
});