From d900022d17da49a6c2fdf504b380ce9c973d57a4 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 17 Jun 2011 08:08:04 -0400 Subject: [PATCH] Added multiple event binding for a specific selector. Need to look into Firefox issue with it --- kis.js | 95 +++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 58 insertions(+), 37 deletions(-) diff --git a/kis.js b/kis.js index f02e27c..aff1732 100644 --- a/kis.js +++ b/kis.js @@ -9,7 +9,7 @@ "use strict"; - var $_, $, kis; + var $_, $; $_ = {}; @@ -76,8 +76,8 @@ for (var name in data) { - if(!data.hasOwnProperty(name)){ continue }; - if(typeof data[name] === "function"){ continue }; + if(!data.hasOwnProperty(name)){ continue; }; + if(typeof data[name] === "function"){ continue; }; var value = data[name].toString(); @@ -241,7 +241,7 @@ * Event api wrapper */ (function(){ - var attach, remove; + var attach, remove, add_remove, e; if(document.addEventListener) { @@ -268,44 +268,65 @@ }; } - var e = { + add_remove = function (sel, event, callback, add) + { + var i,len; + + if(!sel) + { + return false; + } + + //Get the DOM object if you give me a selector string + if(typeof sel === "string") + { + sel = $(sel); + } + + //Multiple events? Run recursively! + event = event.split(" "); + + if(event.length > 1) + { + console.log(event); + + len = event.length; + + for(i=0;i 1) + { + len = sel.length; + for(i=0;i