s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
}
+ jQuery.active++;
+
// Watch for a new set of requests
- if ( s.global && ! jQuery.active++ ) {
+ if ( s.global && jQuery.active === 1 ) {
jQuery.event.trigger( "ajaxStart" );
}
}
if ( s.global ) {
- trigger("ajaxSend", [xhr, s]);
+ contextTrigger("ajaxSend", [xhr, s]);
}
// Wait for a response to come back
// Fire the global callback
if ( s.global ) {
- trigger( "ajaxSuccess", [xhr, s] );
+ contextTrigger( "ajaxSuccess", [xhr, s] );
}
}
// The request was completed
if ( s.global ) {
- trigger( "ajaxComplete", [xhr, s] );
+ contextTrigger( "ajaxComplete", [xhr, s] );
}
// Handle the global AJAX counter
}
}
- function trigger(type, args) {
+ function contextTrigger(type, args) {
(s.context ? jQuery(s.context) : jQuery.event).trigger(type, args);
}
/(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
!/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
- [];
+ [];
return { browser: match[1] || "", version: match[2] || "0" };
},
css: function( elem, name, force, extra ) {
if ( name === "width" || name === "height" ) {
- var val, props = cssShow, which = name === "width" ? cssWidth : cssHeight;
-
- function getWH() {
- val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
-
- if ( extra === "border" ) {
- return;
- }
-
- jQuery.each( which, function() {
- if ( !extra ) {
- val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
- }
-
- if ( extra === "margin" ) {
- val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
- } else {
- val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
- }
- });
- }
-
if ( elem.offsetWidth !== 0 ) {
- getWH();
+ val = getWH( elem, name, extra );
+
} else {
- jQuery.swap( elem, props, getWH );
+ jQuery.swap( elem, cssShow, function() {
+ val = getWH( elem, name, extra );
+ });
}
return Math.max(0, Math.round(val));
}
});
+function getWH( elem, name, extra ) {
+ var which = name === "width" ? cssWidth : cssHeight,
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
+
+ if ( extra === "border" ) {
+ return val;
+ }
+
+ jQuery.each( which, function() {
+ if ( !extra ) {
+ val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
+ }
+
+ if ( extra === "margin" ) {
+ val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
+
+ } else {
+ val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
+ }
+ });
+
+ return val;
+}
+
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth, height = elem.offsetHeight,
speeds: {
slow: 600,
- fast: 200,
- // Default speed
- _default: 400
+ fast: 200,
+ // Default speed
+ _default: 400
},
step: {
}
var events = elemData.events = elemData.events || {},
- eventHandle = elemData.handle, eventHandle;
+ eventHandle = elemData.handle;
if ( !eventHandle ) {
elemData.handle = eventHandle = function() {
if ( name === "live" ) {
// bind live handler
- context.each(function(){
- jQuery.event.add( this, liveConvert( type, selector ),
+ for ( var j = 0, l = context.length; j < l; j++ ) {
+ jQuery.event.add( context[j], liveConvert( type, selector ),
{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
- });
+ }
} else {
// unbind live handler
}
return this;
- }
+ };
});
function liveHandler( event ) {