mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
upgraded to jQuery 1.4.1
This commit is contained in:
Vendored
+253
-174
@@ -1,17 +1,17 @@
|
||||
/*!
|
||||
* jQuery JavaScript Library v1.4
|
||||
* jQuery JavaScript Library v1.4.1
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2010, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://docs.jquery.com/License
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
* http://sizzlejs.com/
|
||||
* Copyright 2010, The Dojo Foundation
|
||||
* Released under the MIT, BSD, and GPL Licenses.
|
||||
*
|
||||
* Date: Wed Jan 13 15:23:05 2010 -0500
|
||||
* Date: Mon Jan 25 19:43:33 2010 -0500
|
||||
*/
|
||||
(function( window, undefined ) {
|
||||
|
||||
@@ -174,7 +174,7 @@ jQuery.fn = jQuery.prototype = {
|
||||
selector: "",
|
||||
|
||||
// The current version of jQuery being used
|
||||
jquery: "1.4",
|
||||
jquery: "1.4.1",
|
||||
|
||||
// The default length of a jQuery object is 0
|
||||
length: 0,
|
||||
@@ -483,6 +483,31 @@ jQuery.extend({
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
error: function( msg ) {
|
||||
throw msg;
|
||||
},
|
||||
|
||||
parseJSON: function( data ) {
|
||||
if ( typeof data !== "string" || !data ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Make sure the incoming data is actual JSON
|
||||
// Logic borrowed from http://json.org/json2.js
|
||||
if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
|
||||
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
|
||||
.replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) {
|
||||
|
||||
// Try to use the native JSON parser first
|
||||
return window.JSON && window.JSON.parse ?
|
||||
window.JSON.parse( data ) :
|
||||
(new Function("return " + data))();
|
||||
|
||||
} else {
|
||||
jQuery.error( "Invalid JSON: " + data );
|
||||
}
|
||||
},
|
||||
|
||||
noop: function() {},
|
||||
|
||||
@@ -670,26 +695,15 @@ jQuery.extend({
|
||||
// Use of jQuery.browser is frowned upon.
|
||||
// More details: http://docs.jquery.com/Utilities/jQuery.browser
|
||||
uaMatch: function( ua ) {
|
||||
var ret = { browser: "" };
|
||||
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
if ( /webkit/.test( ua ) ) {
|
||||
ret = { browser: "webkit", version: /webkit[\/ ]([\w.]+)/ };
|
||||
var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(msie) ([\w.]+)/.exec( ua ) ||
|
||||
!/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
|
||||
[];
|
||||
|
||||
} else if ( /opera/.test( ua ) ) {
|
||||
ret = { browser: "opera", version: /version/.test( ua ) ? /version[\/ ]([\w.]+)/ : /opera[\/ ]([\w.]+)/ };
|
||||
|
||||
} else if ( /msie/.test( ua ) ) {
|
||||
ret = { browser: "msie", version: /msie ([\w.]+)/ };
|
||||
|
||||
} else if ( /mozilla/.test( ua ) && !/compatible/.test( ua ) ) {
|
||||
ret = { browser: "mozilla", version: /rv:([\w.]+)/ };
|
||||
}
|
||||
|
||||
ret.version = (ret.version && ret.version.exec( ua ) || [0, "0"])[1];
|
||||
|
||||
return ret;
|
||||
return { browser: match[1] || "", version: match[2] || "0" };
|
||||
},
|
||||
|
||||
browser: {}
|
||||
@@ -751,12 +765,6 @@ function doScrollCheck() {
|
||||
jQuery.ready();
|
||||
}
|
||||
|
||||
if ( indexOf ) {
|
||||
jQuery.inArray = function( elem, array ) {
|
||||
return indexOf.call( array, elem );
|
||||
};
|
||||
}
|
||||
|
||||
function evalScript( i, elem ) {
|
||||
if ( elem.src ) {
|
||||
jQuery.ajax({
|
||||
@@ -864,6 +872,7 @@ function now() {
|
||||
optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
|
||||
|
||||
// Will be defined later
|
||||
checkClone: false,
|
||||
scriptEval: false,
|
||||
noCloneEvent: true,
|
||||
boxModel: null
|
||||
@@ -896,9 +905,17 @@ function now() {
|
||||
div.cloneNode(true).fireEvent("onclick");
|
||||
}
|
||||
|
||||
div = document.createElement("div");
|
||||
div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
|
||||
|
||||
var fragment = document.createDocumentFragment();
|
||||
fragment.appendChild( div.firstChild );
|
||||
|
||||
// WebKit doesn't clone checked state correctly in fragments
|
||||
jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
|
||||
|
||||
// Figure out if the W3C box model works as expected
|
||||
// document.body must exist before we can do this
|
||||
// TODO: This timeout is temporary until I move ready into core.js.
|
||||
jQuery(function() {
|
||||
var div = document.createElement("div");
|
||||
div.style.width = div.style.paddingLeft = "1px";
|
||||
@@ -1454,7 +1471,7 @@ jQuery.extend({
|
||||
if ( set ) {
|
||||
// We can't allow the type property to be changed (since it causes problems in IE)
|
||||
if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
|
||||
throw "type property can't be changed";
|
||||
jQuery.error( "type property can't be changed" );
|
||||
}
|
||||
|
||||
elem[ name ] = value;
|
||||
@@ -1580,19 +1597,28 @@ jQuery.event = {
|
||||
// Handle multiple events separated by a space
|
||||
// jQuery(...).bind("mouseover mouseout", fn);
|
||||
types = types.split( /\s+/ );
|
||||
var type, i=0;
|
||||
|
||||
var type, i = 0;
|
||||
|
||||
while ( (type = types[ i++ ]) ) {
|
||||
// Namespaced event handlers
|
||||
var namespaces = type.split(".");
|
||||
type = namespaces.shift();
|
||||
|
||||
if ( i > 1 ) {
|
||||
handler = jQuery.proxy( handler );
|
||||
|
||||
if ( data !== undefined ) {
|
||||
handler.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
handler.type = namespaces.slice(0).sort().join(".");
|
||||
|
||||
// Get the current list of functions bound to this event
|
||||
var handlers = events[ type ],
|
||||
special = this.special[ type ] || {};
|
||||
|
||||
|
||||
|
||||
// Init the event handler queue
|
||||
if ( !handlers ) {
|
||||
handlers = events[ type ] = {};
|
||||
@@ -1614,6 +1640,8 @@ jQuery.event = {
|
||||
var modifiedHandler = special.add.call( elem, handler, data, namespaces, handlers );
|
||||
if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) {
|
||||
modifiedHandler.guid = modifiedHandler.guid || handler.guid;
|
||||
modifiedHandler.data = modifiedHandler.data || handler.data;
|
||||
modifiedHandler.type = modifiedHandler.type || handler.type;
|
||||
handler = modifiedHandler;
|
||||
}
|
||||
}
|
||||
@@ -1779,36 +1807,48 @@ jQuery.event = {
|
||||
handle.apply( elem, data );
|
||||
}
|
||||
|
||||
var nativeFn, nativeHandler;
|
||||
var parent = elem.parentNode || elem.ownerDocument;
|
||||
|
||||
// Trigger an inline bound script
|
||||
try {
|
||||
if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
|
||||
nativeFn = elem[ type ];
|
||||
nativeHandler = elem[ "on" + type ];
|
||||
if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
|
||||
event.result = false;
|
||||
}
|
||||
}
|
||||
|
||||
// prevent IE from throwing an error for some elements with some event types, see #3533
|
||||
} catch (e) {}
|
||||
|
||||
var isClick = jQuery.nodeName(elem, "a") && type === "click";
|
||||
if ( !event.isPropagationStopped() && parent ) {
|
||||
jQuery.event.trigger( event, data, parent, true );
|
||||
|
||||
// Trigger the native events (except for clicks on links)
|
||||
if ( !bubbling && nativeFn && !event.isDefaultPrevented() && !isClick ) {
|
||||
this.triggered = true;
|
||||
try {
|
||||
elem[ type ]();
|
||||
// prevent IE from throwing an error for some hidden elements
|
||||
} catch (e) {}
|
||||
} else if ( !event.isDefaultPrevented() ) {
|
||||
var target = event.target, old,
|
||||
isClick = jQuery.nodeName(target, "a") && type === "click";
|
||||
|
||||
// Handle triggering native .onfoo handlers
|
||||
} else if ( nativeHandler && elem[ "on" + type ].apply( elem, data ) === false ) {
|
||||
event.result = false;
|
||||
}
|
||||
if ( !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
|
||||
try {
|
||||
if ( target[ type ] ) {
|
||||
// Make sure that we don't accidentally re-trigger the onFOO events
|
||||
old = target[ "on" + type ];
|
||||
|
||||
this.triggered = false;
|
||||
if ( old ) {
|
||||
target[ "on" + type ] = null;
|
||||
}
|
||||
|
||||
if ( !event.isPropagationStopped() ) {
|
||||
var parent = elem.parentNode || elem.ownerDocument;
|
||||
if ( parent ) {
|
||||
jQuery.event.trigger( event, data, parent, true );
|
||||
this.triggered = true;
|
||||
target[ type ]();
|
||||
}
|
||||
|
||||
// prevent IE from throwing an error for some elements with some event types, see #3533
|
||||
} catch (e) {}
|
||||
|
||||
if ( old ) {
|
||||
target[ "on" + type ] = old;
|
||||
}
|
||||
|
||||
this.triggered = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1937,6 +1977,8 @@ jQuery.event = {
|
||||
jQuery.extend( proxy, data || {} );
|
||||
|
||||
proxy.guid += data.selector + data.live;
|
||||
data.liveProxy = proxy;
|
||||
|
||||
jQuery.event.add( this, data.live, liveHandler, data );
|
||||
|
||||
},
|
||||
@@ -2168,18 +2210,18 @@ function testChange( e ) {
|
||||
data = jQuery.data( elem, "_change_data" );
|
||||
val = getVal(elem);
|
||||
|
||||
if ( val === data ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// the current data will be also retrieved by beforeactivate
|
||||
if ( e.type !== "focusout" || elem.type !== "radio" ) {
|
||||
jQuery.data( elem, "_change_data", val );
|
||||
}
|
||||
|
||||
if ( data === undefined || val === data ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( elem.type !== "select" && (data != null || val) ) {
|
||||
if ( data != null || val ) {
|
||||
e.type = "change";
|
||||
return jQuery.event.trigger( e, arguments[1], this );
|
||||
return jQuery.event.trigger( e, arguments[1], elem );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2274,7 +2316,6 @@ jQuery.each(["bind", "one"], function( i, name ) {
|
||||
}
|
||||
|
||||
if ( jQuery.isFunction( data ) ) {
|
||||
thisObject = fn;
|
||||
fn = data;
|
||||
data = undefined;
|
||||
}
|
||||
@@ -2285,7 +2326,7 @@ jQuery.each(["bind", "one"], function( i, name ) {
|
||||
}) : fn;
|
||||
|
||||
return type === "unload" && name !== "one" ?
|
||||
this.one( type, data, fn, thisObject ) :
|
||||
this.one( type, data, fn ) :
|
||||
this.each(function() {
|
||||
jQuery.event.add( this, type, handler, data );
|
||||
});
|
||||
@@ -2346,32 +2387,52 @@ jQuery.fn.extend({
|
||||
|
||||
hover: function( fnOver, fnOut ) {
|
||||
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
jQuery.each(["live", "die"], function( i, name ) {
|
||||
jQuery.fn[ name ] = function( types, data, fn ) {
|
||||
var type, i = 0;
|
||||
|
||||
live: function( type, data, fn ) {
|
||||
if ( jQuery.isFunction( data ) ) {
|
||||
fn = data;
|
||||
data = undefined;
|
||||
}
|
||||
|
||||
jQuery( this.context ).bind( liveConvert( type, this.selector ), {
|
||||
data: data, selector: this.selector, live: type
|
||||
}, fn );
|
||||
types = (types || "").split( /\s+/ );
|
||||
|
||||
return this;
|
||||
},
|
||||
while ( (type = types[ i++ ]) != null ) {
|
||||
type = type === "focus" ? "focusin" : // focus --> focusin
|
||||
type === "blur" ? "focusout" : // blur --> focusout
|
||||
type === "hover" ? types.push("mouseleave") && "mouseenter" : // hover support
|
||||
type;
|
||||
|
||||
if ( name === "live" ) {
|
||||
// bind live handler
|
||||
jQuery( this.context ).bind( liveConvert( type, this.selector ), {
|
||||
data: data, selector: this.selector, live: type
|
||||
}, fn );
|
||||
|
||||
die: function( type, fn ) {
|
||||
jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null );
|
||||
} else {
|
||||
// unbind live handler
|
||||
jQuery( this.context ).unbind( liveConvert( type, this.selector ), fn ? { guid: fn.guid + this.selector + type } : null );
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
function liveHandler( event ) {
|
||||
var stop = true, elems = [], selectors = [], args = arguments,
|
||||
related, match, fn, elem, j, i, data,
|
||||
var stop, elems = [], selectors = [], args = arguments,
|
||||
related, match, fn, elem, j, i, l, data,
|
||||
live = jQuery.extend({}, jQuery.data( this, "events" ).live);
|
||||
|
||||
// Make sure we avoid non-left-click bubbling in Firefox (#3861)
|
||||
if ( event.button && event.type === "click" ) {
|
||||
return;
|
||||
}
|
||||
|
||||
for ( j in live ) {
|
||||
fn = live[j];
|
||||
if ( fn.live === event.type ||
|
||||
@@ -2422,7 +2483,7 @@ function liveHandler( event ) {
|
||||
}
|
||||
|
||||
function liveConvert( type, selector ) {
|
||||
return ["live", type, selector.replace(/\./g, "`").replace(/ /g, "&")].join(".");
|
||||
return "live." + (type ? type + "." : "") + selector.replace(/\./g, "`").replace(/ /g, "&");
|
||||
}
|
||||
|
||||
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
|
||||
@@ -2569,7 +2630,7 @@ var Sizzle = function(selector, context, results, seed) {
|
||||
}
|
||||
|
||||
if ( !checkSet ) {
|
||||
throw "Syntax error, unrecognized expression: " + (cur || selector);
|
||||
Sizzle.error( cur || selector );
|
||||
}
|
||||
|
||||
if ( toString.call(checkSet) === "[object Array]" ) {
|
||||
@@ -2722,7 +2783,7 @@ Sizzle.filter = function(expr, set, inplace, not){
|
||||
// Improper expression
|
||||
if ( expr === old ) {
|
||||
if ( anyFound == null ) {
|
||||
throw "Syntax error, unrecognized expression: " + expr;
|
||||
Sizzle.error( expr );
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -2734,6 +2795,10 @@ Sizzle.filter = function(expr, set, inplace, not){
|
||||
return curLoop;
|
||||
};
|
||||
|
||||
Sizzle.error = function( msg ) {
|
||||
throw "Syntax error, unrecognized expression: " + msg;
|
||||
};
|
||||
|
||||
var Expr = Sizzle.selectors = {
|
||||
order: [ "ID", "NAME", "TAG" ],
|
||||
match: {
|
||||
@@ -3038,7 +3103,7 @@ var Expr = Sizzle.selectors = {
|
||||
|
||||
return true;
|
||||
} else {
|
||||
throw "Syntax error, unrecognized expression: " + name;
|
||||
Sizzle.error( "Syntax error, unrecognized expression: " + name );
|
||||
}
|
||||
},
|
||||
CHILD: function(elem, match){
|
||||
@@ -3540,7 +3605,7 @@ var winnow = function( elements, qualifier, keep ) {
|
||||
if ( isSimple.test( qualifier ) ) {
|
||||
return jQuery.filter(qualifier, filtered, !keep);
|
||||
} else {
|
||||
qualifier = jQuery.filter( qualifier, elements );
|
||||
qualifier = jQuery.filter( qualifier, filtered );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3751,7 +3816,7 @@ jQuery.extend({
|
||||
|
||||
dir: function( elem, dir, until ) {
|
||||
var matched = [], cur = elem[dir];
|
||||
while ( cur && cur.nodeType !== 9 && (until === undefined || !jQuery( cur ).is( until )) ) {
|
||||
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
|
||||
if ( cur.nodeType === 1 ) {
|
||||
matched.push( cur );
|
||||
}
|
||||
@@ -3792,6 +3857,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
|
||||
rtagName = /<([\w:]+)/,
|
||||
rtbody = /<tbody/i,
|
||||
rhtml = /<|&\w+;/,
|
||||
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
|
||||
fcloseTag = function( all, front, tag ) {
|
||||
return rselfClosing.test( tag ) ?
|
||||
all :
|
||||
@@ -3822,7 +3888,7 @@ jQuery.fn.extend({
|
||||
if ( jQuery.isFunction(text) ) {
|
||||
return this.each(function(i) {
|
||||
var self = jQuery(this);
|
||||
return self.text( text.call(this, i, self.text()) );
|
||||
self.text( text.call(this, i, self.text()) );
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3863,6 +3929,12 @@ jQuery.fn.extend({
|
||||
},
|
||||
|
||||
wrapInner: function( html ) {
|
||||
if ( jQuery.isFunction( html ) ) {
|
||||
return this.each(function(i) {
|
||||
jQuery(this).wrapInner( html.call(this, i) );
|
||||
});
|
||||
}
|
||||
|
||||
return this.each(function() {
|
||||
var self = jQuery( this ), contents = self.contents();
|
||||
|
||||
@@ -3976,11 +4048,13 @@ jQuery.fn.extend({
|
||||
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
|
||||
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
|
||||
|
||||
value = value.replace(rxhtmlTag, fcloseTag);
|
||||
|
||||
try {
|
||||
for ( var i = 0, l = this.length; i < l; i++ ) {
|
||||
// Remove element nodes and prevent memory leaks
|
||||
if ( this[i].nodeType === 1 ) {
|
||||
cleanData( this[i].getElementsByTagName("*") );
|
||||
jQuery.cleanData( this[i].getElementsByTagName("*") );
|
||||
this[i].innerHTML = value;
|
||||
}
|
||||
}
|
||||
@@ -4011,6 +4085,12 @@ jQuery.fn.extend({
|
||||
// this can help fix replacing a parent with child elements
|
||||
if ( !jQuery.isFunction( value ) ) {
|
||||
value = jQuery( value ).detach();
|
||||
|
||||
} else {
|
||||
return this.each(function(i) {
|
||||
var self = jQuery(this), old = self.html();
|
||||
self.replaceWith( value.call( this, i, old ) );
|
||||
});
|
||||
}
|
||||
|
||||
return this.each(function() {
|
||||
@@ -4036,11 +4116,18 @@ jQuery.fn.extend({
|
||||
domManip: function( args, table, callback ) {
|
||||
var results, first, value = args[0], scripts = [];
|
||||
|
||||
// We can't cloneNode fragments that contain checked, in WebKit
|
||||
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
|
||||
return this.each(function() {
|
||||
jQuery(this).domManip( args, table, callback, true );
|
||||
});
|
||||
}
|
||||
|
||||
if ( jQuery.isFunction(value) ) {
|
||||
return this.each(function(i) {
|
||||
var self = jQuery(this);
|
||||
args[0] = value.call(this, i, table ? self.html() : undefined);
|
||||
return self.domManip( args, table, callback );
|
||||
self.domManip( args, table, callback );
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4109,16 +4196,16 @@ function cloneCopyEvent(orig, ret) {
|
||||
}
|
||||
|
||||
function buildFragment( args, nodes, scripts ) {
|
||||
var fragment, cacheable, cached, cacheresults, doc;
|
||||
var fragment, cacheable, cacheresults, doc;
|
||||
|
||||
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && args[0].indexOf("<option") < 0 ) {
|
||||
// webkit does not clone 'checked' attribute of radio inputs on cloneNode, so don't cache if string has a checked
|
||||
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && args[0].indexOf("<option") < 0 && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
|
||||
cacheable = true;
|
||||
cacheresults = jQuery.fragments[ args[0] ];
|
||||
if ( cacheresults ) {
|
||||
if ( cacheresults !== 1 ) {
|
||||
fragment = cacheresults;
|
||||
}
|
||||
cached = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4161,8 +4248,8 @@ jQuery.each({
|
||||
remove: function( selector, keepData ) {
|
||||
if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
|
||||
if ( !keepData && this.nodeType === 1 ) {
|
||||
cleanData( this.getElementsByTagName("*") );
|
||||
cleanData( [ this ] );
|
||||
jQuery.cleanData( this.getElementsByTagName("*") );
|
||||
jQuery.cleanData( [ this ] );
|
||||
}
|
||||
|
||||
if ( this.parentNode ) {
|
||||
@@ -4174,7 +4261,7 @@ jQuery.each({
|
||||
empty: function() {
|
||||
// Remove element nodes and prevent memory leaks
|
||||
if ( this.nodeType === 1 ) {
|
||||
cleanData( this.getElementsByTagName("*") );
|
||||
jQuery.cleanData( this.getElementsByTagName("*") );
|
||||
}
|
||||
|
||||
// Remove any remaining nodes
|
||||
@@ -4281,16 +4368,15 @@ jQuery.extend({
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
|
||||
function cleanData( elems ) {
|
||||
for ( var i = 0, elem, id; (elem = elems[i]) != null; i++ ) {
|
||||
if ( !jQuery.noData[elem.nodeName.toLowerCase()] && (id = elem[expando]) ) {
|
||||
delete jQuery.cache[ id ];
|
||||
},
|
||||
|
||||
cleanData: function( elems ) {
|
||||
for ( var i = 0, elem, id; (elem = elems[i]) != null; i++ ) {
|
||||
jQuery.event.remove( elem );
|
||||
jQuery.removeData( elem );
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// exclude the following css properties to add px
|
||||
var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
|
||||
ralpha = /alpha\([^)]*\)/,
|
||||
@@ -4567,18 +4653,19 @@ jQuery.fn.extend({
|
||||
}
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
// Request the remote document
|
||||
jQuery.ajax({
|
||||
url: url,
|
||||
type: type,
|
||||
dataType: "html",
|
||||
data: params,
|
||||
context:this,
|
||||
complete: function( res, status ) {
|
||||
// If successful, inject the HTML into all the matched elements
|
||||
if ( status === "success" || status === "notmodified" ) {
|
||||
// See if a selector was specified
|
||||
this.html( selector ?
|
||||
self.html( selector ?
|
||||
// Create a dummy div to hold the results
|
||||
jQuery("<div />")
|
||||
// inject the contents of the document in, removing the scripts
|
||||
@@ -4593,7 +4680,7 @@ jQuery.fn.extend({
|
||||
}
|
||||
|
||||
if ( callback ) {
|
||||
this.each( callback, [res.responseText, status, res] );
|
||||
self.each( callback, [res.responseText, status, res] );
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -4727,7 +4814,7 @@ jQuery.extend({
|
||||
var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings);
|
||||
|
||||
var jsonp, status, data,
|
||||
callbackContext = s.context || s,
|
||||
callbackContext = origSettings && origSettings.context || s,
|
||||
type = s.type.toUpperCase();
|
||||
|
||||
// convert data if not already a string
|
||||
@@ -4913,7 +5000,7 @@ jQuery.extend({
|
||||
// Wait for a response to come back
|
||||
var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
|
||||
// The request was aborted
|
||||
if ( !xhr || xhr.readyState === 0 ) {
|
||||
if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
|
||||
// Opera doesn't call onreadystatechange before this point
|
||||
// so we simulate the call
|
||||
if ( !requestDone ) {
|
||||
@@ -4938,13 +5025,16 @@ jQuery.extend({
|
||||
"notmodified" :
|
||||
"success";
|
||||
|
||||
var errMsg;
|
||||
|
||||
if ( status === "success" ) {
|
||||
// Watch for, and catch, XML document parse errors
|
||||
try {
|
||||
// process the data (runs the xml through httpData regardless of callback)
|
||||
data = jQuery.httpData( xhr, s.dataType, s );
|
||||
} catch(e) {
|
||||
} catch(err) {
|
||||
status = "parsererror";
|
||||
errMsg = err;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4955,7 +5045,7 @@ jQuery.extend({
|
||||
success();
|
||||
}
|
||||
} else {
|
||||
jQuery.handleError(s, xhr, status);
|
||||
jQuery.handleError(s, xhr, status, errMsg);
|
||||
}
|
||||
|
||||
// Fire the complete handlers
|
||||
@@ -4979,12 +5069,9 @@ jQuery.extend({
|
||||
xhr.abort = function() {
|
||||
if ( xhr ) {
|
||||
oldAbort.call( xhr );
|
||||
if ( xhr ) {
|
||||
xhr.readyState = 0;
|
||||
}
|
||||
}
|
||||
|
||||
onreadystatechange();
|
||||
onreadystatechange( "abort" );
|
||||
};
|
||||
} catch(e) { }
|
||||
|
||||
@@ -5052,7 +5139,7 @@ jQuery.extend({
|
||||
handleError: function( s, xhr, status, e ) {
|
||||
// If a local callback was specified, fire it
|
||||
if ( s.error ) {
|
||||
s.error.call( s.context || window, xhr, status, e );
|
||||
s.error.call( s.context || s, xhr, status, e );
|
||||
}
|
||||
|
||||
// Fire the global callback
|
||||
@@ -5100,7 +5187,7 @@ jQuery.extend({
|
||||
data = xml ? xhr.responseXML : xhr.responseText;
|
||||
|
||||
if ( xml && data.documentElement.nodeName === "parsererror" ) {
|
||||
throw "parsererror";
|
||||
jQuery.error( "parsererror" );
|
||||
}
|
||||
|
||||
// Allow a pre-filtering function to sanitize the response
|
||||
@@ -5113,23 +5200,7 @@ jQuery.extend({
|
||||
if ( typeof data === "string" ) {
|
||||
// Get the JavaScript object, if JSON is used.
|
||||
if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
|
||||
// Make sure the incoming data is actual JSON
|
||||
// Logic borrowed from http://json.org/json2.js
|
||||
if (/^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
|
||||
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
|
||||
.replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) {
|
||||
|
||||
// Try to use the native JSON parser first
|
||||
if ( window.JSON && window.JSON.parse ) {
|
||||
data = window.JSON.parse( data );
|
||||
|
||||
} else {
|
||||
data = (new Function("return " + data))();
|
||||
}
|
||||
|
||||
} else {
|
||||
throw "Invalid JSON: " + data;
|
||||
}
|
||||
data = jQuery.parseJSON( data );
|
||||
|
||||
// If the type is "script", eval it in global context
|
||||
} else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
|
||||
@@ -5143,7 +5214,6 @@ jQuery.extend({
|
||||
// Serialize an array of form elements or a set of
|
||||
// key/values into a query string
|
||||
param: function( a, traditional ) {
|
||||
|
||||
var s = [];
|
||||
|
||||
// Set traditional to true for jQuery <= 1.3.2 behavior.
|
||||
@@ -5151,12 +5221,6 @@ jQuery.extend({
|
||||
traditional = jQuery.ajaxSettings.traditional;
|
||||
}
|
||||
|
||||
function add( key, value ) {
|
||||
// If value is a function, invoke it and return its value
|
||||
value = jQuery.isFunction(value) ? value() : value;
|
||||
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
|
||||
}
|
||||
|
||||
// If an array was passed in, assume that it is an array of form elements.
|
||||
if ( jQuery.isArray(a) || a.jquery ) {
|
||||
// Serialize the form elements
|
||||
@@ -5167,43 +5231,51 @@ jQuery.extend({
|
||||
} else {
|
||||
// If traditional, encode the "old" way (the way 1.3.2 or older
|
||||
// did it), otherwise encode params recursively.
|
||||
jQuery.each( a, function buildParams( prefix, obj ) {
|
||||
|
||||
if ( jQuery.isArray(obj) ) {
|
||||
// Serialize array item.
|
||||
jQuery.each( obj, function( i, v ) {
|
||||
if ( traditional ) {
|
||||
// Treat each array item as a scalar.
|
||||
add( prefix, v );
|
||||
} else {
|
||||
// If array item is non-scalar (array or object), encode its
|
||||
// numeric index to resolve deserialization ambiguity issues.
|
||||
// Note that rack (as of 1.0.0) can't currently deserialize
|
||||
// nested arrays properly, and attempting to do so may cause
|
||||
// a server error. Possible fixes are to modify rack's
|
||||
// deserialization algorithm or to provide an option or flag
|
||||
// to force array serialization to be shallow.
|
||||
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v );
|
||||
}
|
||||
});
|
||||
|
||||
} else if ( !traditional && obj != null && typeof obj === "object" ) {
|
||||
// Serialize object item.
|
||||
jQuery.each( obj, function( k, v ) {
|
||||
buildParams( prefix + "[" + k + "]", v );
|
||||
});
|
||||
|
||||
} else {
|
||||
// Serialize scalar item.
|
||||
add( prefix, obj );
|
||||
}
|
||||
});
|
||||
for ( var prefix in a ) {
|
||||
buildParams( prefix, a[prefix] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return the resulting serialization
|
||||
return s.join("&").replace(r20, "+");
|
||||
}
|
||||
|
||||
function buildParams( prefix, obj ) {
|
||||
if ( jQuery.isArray(obj) ) {
|
||||
// Serialize array item.
|
||||
jQuery.each( obj, function( i, v ) {
|
||||
if ( traditional ) {
|
||||
// Treat each array item as a scalar.
|
||||
add( prefix, v );
|
||||
} else {
|
||||
// If array item is non-scalar (array or object), encode its
|
||||
// numeric index to resolve deserialization ambiguity issues.
|
||||
// Note that rack (as of 1.0.0) can't currently deserialize
|
||||
// nested arrays properly, and attempting to do so may cause
|
||||
// a server error. Possible fixes are to modify rack's
|
||||
// deserialization algorithm or to provide an option or flag
|
||||
// to force array serialization to be shallow.
|
||||
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v );
|
||||
}
|
||||
});
|
||||
|
||||
} else if ( !traditional && obj != null && typeof obj === "object" ) {
|
||||
// Serialize object item.
|
||||
jQuery.each( obj, function( k, v ) {
|
||||
buildParams( prefix + "[" + k + "]", v );
|
||||
});
|
||||
|
||||
} else {
|
||||
// Serialize scalar item.
|
||||
add( prefix, obj );
|
||||
}
|
||||
}
|
||||
|
||||
function add( key, value ) {
|
||||
// If value is a function, invoke it and return its value
|
||||
value = jQuery.isFunction(value) ? value() : value;
|
||||
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
var elemdisplay = {},
|
||||
rfxtypes = /toggle|show|hide/,
|
||||
@@ -5220,7 +5292,7 @@ var elemdisplay = {},
|
||||
|
||||
jQuery.fn.extend({
|
||||
show: function( speed, callback ) {
|
||||
if ( speed != null ) {
|
||||
if ( speed || speed === 0) {
|
||||
return this.animate( genFx("show", 3), speed, callback);
|
||||
|
||||
} else {
|
||||
@@ -5264,7 +5336,7 @@ jQuery.fn.extend({
|
||||
},
|
||||
|
||||
hide: function( speed, callback ) {
|
||||
if ( speed != null ) {
|
||||
if ( speed || speed === 0 ) {
|
||||
return this.animate( genFx("hide", 3), speed, callback);
|
||||
|
||||
} else {
|
||||
@@ -5691,16 +5763,16 @@ if ( "getBoundingClientRect" in document.documentElement ) {
|
||||
jQuery.fn.offset = function( options ) {
|
||||
var elem = this[0];
|
||||
|
||||
if ( !elem || !elem.ownerDocument ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( options ) {
|
||||
return this.each(function( i ) {
|
||||
jQuery.offset.setOffset( this, options, i );
|
||||
});
|
||||
}
|
||||
|
||||
if ( !elem || !elem.ownerDocument ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( elem === elem.ownerDocument.body ) {
|
||||
return jQuery.offset.bodyOffset( elem );
|
||||
}
|
||||
@@ -5717,16 +5789,16 @@ if ( "getBoundingClientRect" in document.documentElement ) {
|
||||
jQuery.fn.offset = function( options ) {
|
||||
var elem = this[0];
|
||||
|
||||
if ( !elem || !elem.ownerDocument ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( options ) {
|
||||
return this.each(function( i ) {
|
||||
jQuery.offset.setOffset( this, options, i );
|
||||
});
|
||||
}
|
||||
|
||||
if ( !elem || !elem.ownerDocument ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( elem === elem.ownerDocument.body ) {
|
||||
return jQuery.offset.bodyOffset( elem );
|
||||
}
|
||||
@@ -5968,6 +6040,13 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
|
||||
if ( !elem ) {
|
||||
return size == null ? null : this;
|
||||
}
|
||||
|
||||
if ( jQuery.isFunction( size ) ) {
|
||||
return this.each(function( i ) {
|
||||
var self = jQuery( this );
|
||||
self[ type ]( size.call( this, i, self[ type ]() ) );
|
||||
});
|
||||
}
|
||||
|
||||
return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window?
|
||||
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
|
||||
|
||||
Reference in New Issue
Block a user