Skip to content

Instantly share code, notes, and snippets.

@leiming
leiming / berlin-jsconf-2014.md
Created May 17, 2016 17:47 — forked from nikcorg/berlin-jsconf-2014.md
Slide decks of JSConf 2014
@leiming
leiming / addEventListener-polyfill.js
Last active August 29, 2015 14:27 — forked from eirikbacker/addEventListener-polyfill.js
addEventListener polyfill for IE6+
//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence
(function(win, doc){
if(win.addEventListener)return; //No need to polyfill
function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}}
function addEvent(on, fn, self){
return (self = this).attachEvent('on' + on, function(e){
var e = e || win.event;
e.preventDefault = e.preventDefault || function(){e.returnValue = false}
e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true}