Created
November 24, 2015 20:28
-
-
Save gonzazoid/53a4fc39f98b1020bba3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var sgb_view = Object.create(HTMLElement.prototype); | |
if(!("spill" in Event.prototype)){ | |
Events.prototype.spill = function(){ | |
}; | |
} | |
sgb_view.createdCallback = function () { | |
var i, l; | |
if(this.hasAttribute("data-events"){ | |
var events = this.getAttribute("data-events").split(","); | |
}else return; | |
for(i=0, l=events.length; i<l; i++){ | |
this.addEventListener(events[i].trim(), function(evt){ | |
evt.stopPropagation(); | |
evt.spill(); | |
}); | |
} | |
}; | |
document.registerElement("ext-room", { prototype: sgb_view }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
discuss the code here: http://htmlviews.net/index.php/2015/11/24/ext-room/