Skip to content

Commit

Permalink
Add hasClass and find functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ianfeather committed Jul 25, 2013
1 parent 6246d96 commit 2dabbea
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
9 changes: 9 additions & 0 deletions dist/$.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ $$ = (function (document, window, $$) {
return this;
};

node.find = function (klass) {
var r = this.querySelectorAll(klass || '☺'),
length = r.length;
return length == 1 ? r[0] : r;
};

node.hasClass = function (klass) {
return ((" " + element.className + " ").replace(/[\n\t]/g, " ").indexOf(klass) > -1) ? true : false;
}

// Get a cookie value
cookies.get = function(key) {
Expand Down
2 changes: 1 addition & 1 deletion dist/$.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/$.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ $$ = (function (document, window, $$) {
return this;
};

node.find = function (klass) {
var r = this.querySelectorAll(klass || '☺'),
length = r.length;
return length == 1 ? r[0] : r;
};

node.hasClass = function (klass) {
return ((" " + element.className + " ").replace(/[\n\t]/g, " ").indexOf(klass) > -1) ? true : false;
}

// Get a cookie value
cookies.get = function(key) {
Expand Down

0 comments on commit 2dabbea

Please sign in to comment.