From a41e850db90edef8628aa6b764b06fc08f7883d0 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 15 Jun 2011 08:33:16 -0400 Subject: [PATCH] Simplified event module, added event module documentation --- README.md | 15 ++++++++++++++- kis.js | 9 ++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 473089c..5d80024 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Browser support: IE8+, Latest versions of Firefox, Chrome, Safari, Opera **Store**: localstorage wrapper with automatic data serialization - functions + functions: * Get: Use: @@ -57,6 +57,19 @@ Browser support: IE8+, Latest versions of Firefox, Chrome, Safari, Opera * getALL: Retreives all localstorage data in raw form Use: $_.store.getAll(); + + +**Event**: wrapper for applying events to DOM objects + + function: + + *Add: + Use: + $_.event.add(selector, event, callback); + + *Remove + Use: + $_.event.remove(selector, event, callback); diff --git a/kis.js b/kis.js index bff34fe..b9ea62d 100644 --- a/kis.js +++ b/kis.js @@ -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(); @@ -242,13 +242,12 @@ */ (function(){ var attach, remove; - var eType = (document.addEventListener) ? "good" : "bad"; - if(eType === "good") + if(document.addEventListener) { attach = function(sel, event, callback) { - sel.addEventListener(event, callback, false) + sel.addEventListener(event, callback, false); }; remove = function(sel, event, callback)