Commit 0fd3648d authored by John Resig's avatar John Resig

Added in both of Franck's suggested fixes jQuery.class and "foo" + "bar".split(",").

parent 6ae392a4
...@@ -67,9 +67,9 @@ jQuery.prototype.ready = function(f) { ...@@ -67,9 +67,9 @@ jQuery.prototype.ready = function(f) {
/* /*
* Bind a number of event-handling functions, dynamically * Bind a number of event-handling functions, dynamically
*/ */
var e = "blur,focus,contextmenu,load,resize,scroll,unload,click,dblclick," + var e = ("blur,focus,contextmenu,load,resize,scroll,unload,click,dblclick," +
"mousedown,mouseup,mouseenter,mouseleave,mousemove,mouseover,mouseout," + "mousedown,mouseup,mouseenter,mouseleave,mousemove,mouseover,mouseout," +
"change,reset,select,submit,keydown,keypress,keyup,abort,error,ready".split(","); "change,reset,select,submit,keydown,keypress,keyup").split(",");
// Go through all the event names, but make sure that // Go through all the event names, but make sure that
// it is enclosed properly // it is enclosed properly
......
...@@ -129,21 +129,21 @@ jQuery.fn = jQuery.prototype = { ...@@ -129,21 +129,21 @@ jQuery.fn = jQuery.prototype = {
}, },
addClass: function(c) { addClass: function(c) {
return this.each(function(){ return this.each(function(){
jQuery.class.add(this,c); jQuery.className.add(this,c);
}); });
}, },
removeClass: function(c) { removeClass: function(c) {
return this.each(function(){ return this.each(function(){
jQuery.class.remove(this,c); jQuery.className.remove(this,c);
}); });
}, },
toggleClass: function(c) { toggleClass: function(c) {
return this.each(function(){ return this.each(function(){
if (jQuery.hasWord(this,c)) if (jQuery.hasWord(this,c))
jQuery.class.remove(this,c); jQuery.className.remove(this,c);
else else
jQuery.class.add(this,c); jQuery.className.add(this,c);
}); });
}, },
remove: function() { remove: function() {
...@@ -318,10 +318,10 @@ jQuery.fn = jQuery.prototype = { ...@@ -318,10 +318,10 @@ jQuery.fn = jQuery.prototype = {
} }
}; };
jQuery.class = { jQuery.className = {
add: function(o,c){ add: function(o,c){
if (jQuery.hasWord(o,c)) return; if (jQuery.hasWord(o,c)) return;
o.className += ( o.className.length > 0 ? " " : "" ) + c; o.className += ( o.className ? " " : "" ) + c;
}, },
remove: function(o,c){ remove: function(o,c){
o.className = !c ? "" : o.className = !c ? "" :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment