Skip to content

Instantly share code, notes, and snippets.

View 5509's full-sized avatar

Kazunori Tokuda 5509

  • PixelGrid, Inc.
  • Tokyo, Japan
View GitHub Profile
@5509
5509 / bind and unbind funcs
Created April 5, 2011 17:29
巡り巡ってElement.prototypeを断念。。namespace使ってbind、unbindできる(IE8以下を除く)
/*
* bind, unbind
*
* @author : nori(norimanai@gmail.com)
* @copyright : 5509(http://5509.me/)
* @license : The MIT License
* @modified : 2011-04-09 01:30
*
* HOW TO USE
* bind event : bind(elm, type, func) or bind(elm, {})
@5509
5509 / bind()
Created April 4, 2011 09:42
汎用addEventListener(IE8以下を除く)
/*
* Bind events
* bind(obj, listener, func)
* or
* bind(obj, {
* listener : func,
* listener2 : func2,
* // and more
* })
*/
@5509
5509 / classList
Created March 31, 2011 01:16
classList(DOMTokenList) polyfills
;(function() {
if ( !Element.__defineGetter__ || Element.prototype.hasOwnProperty("classList") ) return;
function classList(elm) {
this.elm = elm;
}
classList.prototype = {
add: function(klass) {
var _elm = this.elm,