Хранилища Subversion ant

Сравнить редакции

Не учитывать пробелы Редакция 289 → Редакция 283

/trunk/js/jquery.js
6,19 → 6,17
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-06-17 09:31:45 +0700 (Срд, 17 Июн 2009)
* Revision: 6399
* Date: 2009-05-12 22:43:51 +0700 (Втр, 12 Май 2009)
* Revision: 6348
*/
(function(window, undefined){
(function(){
 
// Define a local copy of jQuery
var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return arguments.length === 0 ?
rootjQuery :
new jQuery.fn.init( selector, context );
},
// Will speed up references to window, and allows munging its name.
var window = this,
 
// Will speed up references to undefined, and allows munging its name.
undefined,
 
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
 
25,9 → 23,19
// Map over the $ in case of overwrite
_$ = window.$,
 
// Define a local copy of jQuery
jQuery,
 
// A central reference to the root jQuery(document)
rootjQuery,
 
jQuery = window.jQuery = window.$ = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return arguments.length === 0 ?
rootjQuery :
new jQuery.fn.init( selector, context );
},
 
// A simple way to check for HTML strings or ID strings
// (both of which we optimize for)
quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
41,9 → 49,6
// Save a reference to the core toString method
toString = Object.prototype.toString;
 
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
 
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
var match, elem, ret;
1190,7 → 1195,7
} else if ( name === "not" ) {
var not = match[3];
 
for ( i = 0, l = not.length; i < l; i++ ) {
for ( var i = 0, l = not.length; i < l; i++ ) {
if ( not[i] === elem ) {
return false;
}
1204,13 → 1209,13
switch (type) {
case 'only':
case 'first':
while ( (node = node.previousSibling) ) {
while (node = node.previousSibling) {
if ( node.nodeType === 1 ) return false;
}
if ( type == 'first') return true;
node = elem;
case 'last':
while ( (node = node.nextSibling) ) {
while (node = node.nextSibling) {
if ( node.nodeType === 1 ) return false;
}
return true;
1616,21 → 1621,11
jQuery.expr[":"] = jQuery.expr.filters;
 
Sizzle.selectors.filters.hidden = function(elem){
var width = elem.offsetWidth, height = elem.offsetHeight;
return ( width === 0 && height === 0 ) ?
true :
( width !== 0 && height !== 0 ) ?
false :
!!( jQuery.curCSS(elem, "display") === "none" );
return elem.offsetWidth === 0 && elem.offsetHeight === 0;
};
 
Sizzle.selectors.filters.visible = function(elem){
var width = elem.offsetWidth, height = elem.offsetHeight;
return ( width === 0 && height === 0 ) ?
false :
( width > 0 && height > 0 ) ?
true :
!!( jQuery.curCSS(elem, "display") !== "none" );
return elem.offsetWidth > 0 || elem.offsetHeight > 0;
};
 
Sizzle.selectors.filters.animated = function(elem){
2251,7 → 2246,8
remove: function( selector ) {
if ( !selector || jQuery.multiFilter( selector, [ this ] ).length ) {
if ( this.nodeType === 1 ) {
cleanData( jQuery("*", this).add(this) );
cleanData( this.getElementsByTagName("*") );
cleanData( [this] );
}
 
if ( this.parentNode ) {
2263,7 → 2259,7
empty: function() {
// Remove element nodes and prevent memory leaks
if ( this.nodeType === 1 ) {
cleanData( jQuery("*", this) );
cleanData( this.getElementsByTagName("*") );
}
 
// Remove any remaining nodes
2656,22 → 2652,16
handle.apply( elem, data );
}
 
var nativeFn, nativeHandler;
try {
nativeFn = elem[ type ];
nativeHandler = elem[ "on" + type ];
// prevent IE from throwing an error for some elements with some event types, see #3533
} catch (e) {}
// Handle triggering native .onfoo handlers (and on links since we don't call .click() for links)
if ( (!nativeFn || (jQuery.nodeName(elem, 'a') && type === "click")) && nativeHandler && nativeHandler.apply( elem, data ) === false ) {
if ( (!elem[ type ] || (jQuery.nodeName(elem, 'a') && type === "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) {
event.result = false;
}
 
// Trigger the native events (except for clicks on links)
if ( !bubbling && nativeFn && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type === "click") ) {
if ( !bubbling && elem[ type ] && !event.isDefaultPrevented() && !(jQuery.nodeName(elem, 'a') && type === "click") ) {
this.triggered = true;
try {
nativeFn();
elem[ type ]();
// prevent IE from throwing an error for some hidden elements
} catch (e) {}
}
2783,7 → 2773,7
 
// Add which for click: 1 == left; 2 == middle; 3 == right
// Note: button is not normalized, so don't use it
if ( !event.which && event.button !== undefined ) {
if ( !event.which && event.button ) {
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
}
 
3296,7 → 3286,6
maxlength: "maxLength",
cellspacing: "cellSpacing",
rowspan: "rowSpan",
colspan: "colSpan",
tabindex: "tabIndex"
};
// exclude the following css properties to add px
3421,12 → 3410,12
},
 
curCSS: function( elem, name, force ) {
var ret, style = elem.style, filter;
var ret, style = elem.style;
 
// IE uses filters for opacity
if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) {
ret = (elem.currentStyle.filter || "").match(/opacity=([^)]*)/) ?
(parseFloat(RegExp.$1) / 100) + "" :
if ( !jQuery.support.opacity && name == "opacity" ) {
ret = style.filter && style.filter.indexOf("opacity=") >= 0 ?
(parseFloat( style.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
"";
 
return ret === "" ?
3675,7 → 3664,6
 
// Last-Modified header cache for next request
lastModified: {},
etag: {},
 
ajax: function( s ) {
// Extend the settings, but re-extend 's' so that it can be
3739,6 → 3727,9
// If data is available, append data to url for get requests
if ( s.data && type == "GET" ) {
s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
 
// IE likes to send both get and post data, prevent this
s.data = null;
}
 
// Watch for a new set of requests
3804,13 → 3795,10
if ( s.data )
xhr.setRequestHeader("Content-Type", s.contentType);
 
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if (jQuery.lastModified[s.url])
xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
if (jQuery.etag[s.url])
xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
}
// Set the If-Modified-Since header, if ifModified mode.
if ( s.ifModified )
xhr.setRequestHeader("If-Modified-Since",
jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
 
// Set header so the called script knows that it's an XMLHttpRequest
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
3872,7 → 3860,16
}
 
// Make sure that the request was successful or notmodified
if ( status == "success" || status == "notmodified" ) {
if ( status == "success" ) {
// Cache Last-Modified header, if ifModified mode.
var modRes;
try {
modRes = xhr.getResponseHeader("Last-Modified");
} catch(e) {} // swallow exception thrown by FF if header is not available
 
if ( s.ifModified && modRes )
jQuery.lastModified[s.url] = modRes;
 
// JSONP handles its own success callback
if ( !jsonp )
success();
3906,7 → 3903,7
 
// Send the data
try {
xhr.send( type === "POST" ? s.data : null );
xhr.send(s.data);
} catch(e) {
jQuery.handleError(s, xhr, null, e);
}
3967,16 → 3964,13
 
// Determines if an XMLHttpRequest returns NotModified
httpNotModified: function( xhr, url ) {
var last_modified = xhr.getResponseHeader("Last-Modified");
var etag = xhr.getResponseHeader("Etag");
try {
var xhrRes = xhr.getResponseHeader("Last-Modified");
 
if (last_modified)
jQuery.lastModified[url] = last_modified;
 
if (etag)
jQuery.etag[url] = etag;
 
return xhr.status == 304;
// Firefox always returns 200. check Last-Modified date
return xhr.status == 304 || xhrRes == jQuery.lastModified[url];
} catch(e){}
return false;
},
 
httpData: function( xhr, type, s ) {
3984,32 → 3978,24
xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
data = xml ? xhr.responseXML : xhr.responseText;
 
if ( xml && data.documentElement.tagName == "parsererror" ) {
if ( xml && data.documentElement.tagName == "parsererror" )
throw "parsererror";
}
 
// Allow a pre-filtering function to sanitize the response
// s != null is checked to keep backwards compatibility
if ( s && s.dataFilter ) {
if( s && s.dataFilter )
data = s.dataFilter( data, type );
}
 
// The filter can actually parse the response
if ( typeof data === "string" ) {
if( typeof data === "string" ){
 
// If the type is "script", eval it in global context
if ( type === "script" ) {
if ( type == "script" )
jQuery.globalEval( data );
}
 
// Get the JavaScript object, if JSON is used.
if ( type == "json" ) {
if ( typeof JSON === "object" && JSON.parse ) {
data = JSON.parse( data );
} else {
data = (new Function("return " + data))();
}
}
if ( type == "json" )
data = window["eval"]("(" + data + ")");
}
 
return data;
4337,8 → 4323,20
 
t.elem = this.elem;
 
if ( t() && jQuery.timers.push(t) && !timerId )
timerId = setInterval(jQuery.fx.tick, 13);
if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = setInterval(function(){
var timers = jQuery.timers;
 
for ( var i = 0; i < timers.length; i++ )
if ( !timers[i]() )
timers.splice(i--, 1);
 
if ( !timers.length ) {
clearInterval( timerId );
timerId = undefined;
}
}, 13);
}
},
 
// Simple 'show' function
4425,23 → 4423,6
};
 
jQuery.extend( jQuery.fx, {
 
tick:function(){
var timers = jQuery.timers;
 
for ( var i = 0; i < timers.length; i++ )
if ( !timers[i]() )
timers.splice(i--, 1);
 
if ( !timers.length )
jQuery.fx.stop();
},
stop:function(){
clearInterval( timerId );
timerId = null;
},
speeds:{
slow: 600,
fast: 200,
4448,7 → 4429,6
// Default speed
_default: 400
},
 
step: {
 
opacity: function(fx){
4676,4 → 4656,4
};
 
});
})(window);
})();