component.js
function(parentClass, isWhat, tag, features) {	// v0 spec implementation using https://github.com/WebReflection/document-register-element 	

			var elementClass = Object.create(parentClass.prototype);

			// Clone event handlers			
			if (elementClass.eventHandlers) {
				var clonedHandlers = {};
				for (var i in elementClass.eventHandlers) {
					var handlers = elementClass.eventHandlers[i];
					clonedHandlers[i] = handlers.slice(0); // Clone array of listeners;
				}
				elementClass.eventHandlers = clonedHandlers;
			}

			// Lifecycle
			elementClass.createdCallback = function () {
				// Add event listeners
				for (var i in this.eventHandlers) {
					var event = new CustomEvent(i);
					for (var j in this.eventHandlers[i]) {
						this.addEventListener(event.type, this.eventHandlers[i][j]);
					}
				}

				// Trigger create
				var event = new CustomEvent('create');
				this.dispatchEvent(event);
			};
			elementClass.attachedCallback = function () {
				var event = new CustomEvent('attach');
				this.dispatchEvent(event);
			};
			elementClass.detachedCallback = function () {
				var event = new CustomEvent('detach');
				this.dispatchEvent(event);
			};
			elementClass.attributeChangedCallback = function (attributeName) {
				var event = new CustomEvent('attributeChange', { detail: { attributeName: attributeName } });
				this.dispatchEvent(event);
			};

			// Attach features
			if (features) {
				if (!features.length) { // Can't use Array.isArray 
					features = [features];
				}
				for (var i=0;i<features.length;i++) {
					utils.addFeature(elementClass, features[i]);
				}
			}

			var params = {
				prototype: elementClass
			};

			if (tag) {
				params.extends = tag;
			}
			var elementConstructor = document.registerElement(isWhat, params); // v0 syntax		

			return elementConstructor;
		}
function(parentClass, isWhat, tag, features) {	// v0 spec implementation using https://github.com/WebReflection/document-register-element 	

			var elementClass = Object.create(parentClass.prototype);

			// Clone event handlers			
			if (elementClass.eventHandlers) {
				var clonedHandlers = {};
				for (var i in elementClass.eventHandlers) {
					var handlers = elementClass.eventHandlers[i];
					clonedHandlers[i] = handlers.slice(0); // Clone array of listeners;
				}
				elementClass.eventHandlers = clonedHandlers;
			}

			// Lifecycle
			elementClass.createdCallback = function () {
				// Add event listeners
				for (var i in this.eventHandlers) {
					var event = new CustomEvent(i);
					for (var j in this.eventHandlers[i]) {
						this.addEventListener(event.type, this.eventHandlers[i][j]);
					}
				}

				// Trigger create
				var event = new CustomEvent('create');
				this.dispatchEvent(event);
			};
			elementClass.attachedCallback = function () {
				var event = new CustomEvent('attach');
				this.dispatchEvent(event);
			};
			elementClass.detachedCallback = function () {
				var event = new CustomEvent('detach');
				this.dispatchEvent(event);
			};
			elementClass.attributeChangedCallback = function (attributeName) {
				var event = new CustomEvent('attributeChange', { detail: { attributeName: attributeName } });
				this.dispatchEvent(event);
			};

			// Attach features
			if (features) {
				if (!features.length) { // Can't use Array.isArray 
					features = [features];
				}
				for (var i=0;i<features.length;i++) {
					utils.addFeature(elementClass, features[i]);
				}
			}

			var params = {
				prototype: elementClass
			};

			if (tag) {
				params.extends = tag;
			}
			var elementConstructor = document.registerElement(isWhat, params); // v0 syntax		

			return elementConstructor;
		}
function ( parentClass , isWhat , tag , features ) { // v0 spec implementation using https://github.com/WebReflection/document-register-element 	 var elementClass = Object . create ( parentClass . prototype ) ; // Clone event handlers			 if ( elementClass . eventHandlers ) { var clonedHandlers = { } ; for ( var i in elementClass . eventHandlers ) { var handlers = elementClass . eventHandlers [ i ] ; clonedHandlers [ i ] = handlers . slice ( 0 ) ; // Clone array of listeners; } elementClass . eventHandlers = clonedHandlers ; } // Lifecycle elementClass . createdCallback = function ( ) { // Add event listeners for ( var i in this . eventHandlers ) { var event = new CustomEvent ( i ) ; for ( var j in this . eventHandlers [ i ] ) { this . addEventListener ( event . type , this . eventHandlers [ i ] [ j ] ) ; } } // Trigger create var event = new CustomEvent ( 'create' ) ; this . dispatchEvent ( event ) ; } ; elementClass . attachedCallback = function ( ) { var event = new CustomEvent ( 'attach' ) ; this . dispatchEvent ( event ) ; } ; elementClass . detachedCallback = function ( ) { var event = new CustomEvent ( 'detach' ) ; this . dispatchEvent ( event ) ; } ; elementClass . attributeChangedCallback = function ( attributeName ) { var event = new CustomEvent ( 'attributeChange' , { detail : { attributeName : attributeName } } ) ; this . dispatchEvent ( event ) ; } ; // Attach features if ( features ) { if ( ! features . length ) { // Can't use Array.isArray  features = [ features ] ; } for ( var i = 0 ; i < features . length ; i ++ ) { utils . addFeature ( elementClass , features [ i ] ) ; } } var params = { prototype : elementClass } ; if ( tag ) { params . extends = tag ; } var elementConstructor = document . registerElement ( isWhat , params ) ; // v0 syntax		 return elementConstructor ; }
Register custom element in the DOM using spec v0
@param {function} [HTMLElement] prarentClass - Constructor or class of the element
@param {string} isWhat - Name for the component. Could be used as tag name or "is" attribute
@param {string=} tag - Tag name of the element. Required when extending native elements
@param {object|array} feature - One or more features to have
@return {function} - Constructor of registered element
Register custom element in the DOM using spec v0