From 416ceba451ffe09add9a24f3da123a3f5cb127ad Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 21 Jun 2011 10:43:31 -0400 Subject: [PATCH] Added dom module and docs --- README.md | 14 ++++++++++- kis.js | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 86 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2e516e0..bf5e1af 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Browser support: IE8+, Latest versions of Firefox, Chrome, Safari, Opera **Event**: wrapper for applying events to DOM objects - function: + functions: *Add: Use: @@ -70,6 +70,18 @@ Browser support: IE8+, Latest versions of Firefox, Chrome, Safari, Opera *Remove Use: $_.event.remove(selector, event, callback); + +**DOM**: Dom manipulation module + + function: + + *addClass: + Use: + $_.dom.addClass(selector, className); + + *RemoveClass: + Use: + $_.dom.removeClass(selector, className); diff --git a/kis.js b/kis.js index a13f845..f5adad6 100644 --- a/kis.js +++ b/kis.js @@ -209,7 +209,7 @@ }, set: function(key, value) { - if(typeof value === "object") + if(typeof value !== "string") { value = JSON.stringify(value); } @@ -345,4 +345,76 @@ }()); + /** + * Dom manipulation object + * + */ + (function(){ + var d, c, cs, len; + + function _get(sel, c) + { + c = sel.className; + + if(typeof c === "string") + { + var cs = c.split(" "); + var len = cs.length; + + for(var i=0;i