diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2012-03-24 12:48:16 -0400 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2012-03-24 12:48:16 -0400 |
commit | be76bf3d232d57a86e3fced0e73defb8aef37fbf (patch) | |
tree | 8fb47f70a8f88fa2d00044397e4f706974d0e7e6 /lib/classList.js | |
parent | 87529c4adcb047398da8416a2015d6a439f90f29 (diff) | |
download | fosdem-2018-presentation-be76bf3d232d57a86e3fced0e73defb8aef37fbf.tar fosdem-2018-presentation-be76bf3d232d57a86e3fced0e73defb8aef37fbf.tar.gz |
classList polyfill included for ie9
Diffstat (limited to 'lib/classList.js')
-rw-r--r-- | lib/classList.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/classList.js b/lib/classList.js new file mode 100644 index 0000000..1bb626d --- /dev/null +++ b/lib/classList.js @@ -0,0 +1,3 @@ +// classList polyfill from https://github.com/remy/polyfills/blob/master/classList.js +(function(){function c(a){this._element=a;if(a.className!=this.classCache){this._classCache=a.className;var a=this._classCache.split(" "),b;for(b=0;b<a.length;b++)e.call(this,a[b])}}if(!("undefined"===typeof Element||Element.prototype.hasOwnProperty("classList"))){var d=[].indexOf,f=[].slice,e=[].push,g=[].splice,h=[].join;c.prototype={add:function(a){e.call(this,a);this._element.className=f.call(this,0).join(" ")},contains:function(a){return-1!==d.call(this,a)},item:function(a){return this[a]||null}, +remove:function(a){a=d.call(this,a);g.call(this,a,1);this._element.className=f.call(this,0).join(" ")},toString:function(){return h.call(this," ")},toggle:function(a){-1===d.call(this,a)?this.add(a):this.remove(a)}};window.DOMTokenList=c;Element.prototype.__defineGetter__("classList",function(){return new c(this)})}})();
\ No newline at end of file |