aboutsummaryrefslogtreecommitdiffstats
path: root/src/jqLite.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/jqLite.js')
-rw-r--r--src/jqLite.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index e9407987..6fc16e57 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -140,6 +140,11 @@ JQLite.prototype = {
this[0].className = trim((" " + this[0].className + " ").replace(/[\n\t]/g, " ").replace(" " + selector + " ", ""));
},
+ toggleClass: function(selector, condition) {
+ var self = this;
+ (condition ? self.addClass : self.removeClass).call(self, selector);
+ },
+
addClass: function( selector ) {
if (!this.hasClass(selector)) {
this[0].className = trim(this[0].className + ' ' + selector);