6,8 → 6,8 |
* 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-07-28 03:48:42 +0700 (Втр, 28 Июл 2009) |
* Revision: 6514 |
*/ |
(function(window, undefined){ |
|
25,21 → 25,32 |
// Map over the $ in case of overwrite |
_$ = window.$, |
|
// Use the correct document accordingly with window argument (sandbox) |
document = window.document, |
|
// A central reference to the root jQuery(document) |
rootjQuery, |
|
// A simple way to check for HTML strings or ID strings |
// (both of which we optimize for) |
quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, |
quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/, |
|
// Is it a simple selector |
isSimple = /^.[^:#\[\.,]*$/, |
|
// Check if a string has a non-whitespace character in it |
rnotwhite = /\S/, |
|
// Used for trimming whitespace |
rtrim = /^\s+|\s+$/g, |
|
// Keep a UserAgent string for use with jQuery.browser |
userAgent = navigator.userAgent.toLowerCase(), |
|
// Save a reference to the core toString method |
toString = Object.prototype.toString; |
// Save a reference to some core methods |
toString = Object.prototype.toString, |
push = Array.prototype.push, |
slice = Array.prototype.slice; |
|
// Expose jQuery to the global object |
window.jQuery = window.$ = jQuery; |
50,15 → 61,13 |
|
// Handle $(""), $(null), or $(undefined) |
if ( !selector ) { |
this.length = 0; |
return this; |
} |
|
// Handle $(DOMElement) |
if ( selector.nodeType ) { |
this[0] = selector; |
this.length = 1; |
this.context = selector; |
this.context = this[0] = selector; |
this.length++; |
return this; |
} |
|
76,19 → 85,23 |
|
// HANDLE: $("#id") |
} else { |
elem = document.getElementById( match[3] ); |
elem = document.getElementById( match[2] ); |
|
// Handle the case where IE and Opera return items |
// by name instead of ID |
if ( elem && elem.id !== match[3] ) { |
return rootjQuery.find( selector ); |
if ( elem ) { |
// Handle the case where IE and Opera return items |
// by name instead of ID |
if ( elem.id !== match[2] ) { |
return rootjQuery.find( selector ); |
} |
|
// Otherwise, we inject the element directly into the jQuery object |
this.length++; |
this[0] = elem; |
} |
|
// Otherwise, we inject the element directly into the jQuery object |
ret = jQuery( elem || null ); |
ret.context = document; |
ret.selector = selector; |
return ret; |
this.context = document; |
this.selector = selector; |
return this; |
} |
|
// HANDLE: $(expr, $(...)) |
124,11 → 137,18 |
// The current version of jQuery being used |
jquery: "1.3.3pre", |
|
// The default length of a jQuery object is 0 |
length: 0, |
|
// The number of elements contained in the matched element set |
size: function() { |
return this.length; |
}, |
|
toArray: function(){ |
return slice.call( this, 0 ); |
}, |
|
// Get the Nth element in the matched element set OR |
// Get the whole matched element set as a clean array |
get: function( num ) { |
135,10 → 155,10 |
return num == null ? |
|
// Return a 'clean' array |
Array.prototype.slice.call( this ) : |
this.toArray() : |
|
// Return just the object |
this[ num ]; |
( num < 0 ? this.slice(num)[ 0 ] : this[ num ] ); |
}, |
|
// Take an array of elements and push it onto the stack |
169,7 → 189,7 |
// Resetting the length to 0, then using the native Array push |
// is a super-fast way to populate an object with array-like properties |
this.length = 0; |
Array.prototype.push.apply( this, elems ); |
push.apply( this, elems ); |
|
return this; |
}, |
202,7 → 222,7 |
|
// For internal use only. |
// Behaves like an Array's method, not like a jQuery method. |
push: [].push, |
push: push, |
sort: [].sort, |
splice: [].splice |
}; |
248,10 → 268,21 |
|
// Recurse if we're merging object values |
if ( deep && copy && typeof copy === "object" && !copy.nodeType ) { |
target[ name ] = jQuery.extend( deep, |
// Never move original objects, clone them |
src || ( copy.length != null ? [ ] : { } ), copy ); |
var clone; |
|
if ( src ) { |
clone = src; |
} else if ( jQuery.isArray(copy) ) { |
clone = []; |
} else if ( jQuery.isObject(copy) ) { |
clone = {}; |
} else { |
clone = copy; |
} |
|
// Never move original objects, clone them |
target[ name ] = jQuery.extend( deep, clone, copy ); |
|
// Don't bring in undefined values |
} else if ( copy !== undefined ) { |
target[ name ] = copy; |
286,15 → 317,27 |
return toString.call(obj) === "[object Array]"; |
}, |
|
isObject: function( obj ) { |
return this.constructor.call(obj) === Object; |
}, |
|
isEmptyObject: function( obj ) { |
for ( var name in obj ) { |
return false; |
} |
return true; |
}, |
|
// check if an element is in a (or is an) XML document |
isXMLDoc: function( elem ) { |
return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || |
!!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML"; |
// documentElement is verified for cases where it doesn't yet exist |
// (such as loading iframes in IE - #4833) |
return ((elem.ownerDocument || elem).documentElement || 0).nodeName !== "HTML"; |
}, |
|
// Evalulates a script in a global context |
globalEval: function( data ) { |
if ( data && /\S/.test(data) ) { |
if ( data && rnotwhite.test(data) ) { |
// Inspired by code by Andrea Giammarchi |
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html |
var head = document.getElementsByTagName("head")[0] || document.documentElement, |
301,6 → 344,7 |
script = document.createElement("script"); |
|
script.type = "text/javascript"; |
|
if ( jQuery.support.scriptEval ) { |
script.appendChild( document.createTextNode( data ) ); |
} else { |
320,10 → 364,12 |
|
// args is for internal usage only |
each: function( object, callback, args ) { |
var name, i = 0, length = object.length; |
var name, i = 0, |
length = object.length, |
isObj = length === undefined || jQuery.isFunction(object); |
|
if ( args ) { |
if ( length === undefined ) { |
if ( isObj ) { |
for ( name in object ) { |
if ( callback.apply( object[ name ], args ) === false ) { |
break; |
339,7 → 385,7 |
|
// A special, fast, case for the most common use of each |
} else { |
if ( length === undefined ) { |
if ( isObj ) { |
for ( name in object ) { |
if ( callback.call( object[ name ], name, object[ name ] ) === false ) { |
break; |
355,7 → 401,7 |
}, |
|
trim: function( text ) { |
return (text || "").replace( /^\s+|\s+$/g, "" ); |
return (text || "").replace( rtrim, "" ); |
}, |
|
makeArray: function( array ) { |
463,7 → 509,7 |
// It's included for backwards compatibility and plugins, |
// although they should work to migrate away. |
browser: { |
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1], |
version: (/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/.exec(userAgent) || [0,'0'])[1], |
safari: /webkit/.test( userAgent ), |
opera: /opera/.test( userAgent ), |
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), |
503,25 → 549,24 |
windowData : |
elem; |
|
var id = elem[ expando ]; |
var id = elem[ expando ], cache = jQuery.cache; |
|
// Compute a unique ID for the element |
if ( !id ) |
id = elem[ expando ] = ++uuid; |
if(!id) id = elem[ expando ] = ++uuid; |
|
// Only generate the data cache if we're |
// trying to access or manipulate it |
if ( name && !jQuery.cache[ id ] ) |
jQuery.cache[ id ] = {}; |
if ( name && !cache[ id ] ) |
cache[ id ] = {}; |
|
var thisCache = cache[ id ]; |
|
// Prevent overriding the named cache with undefined values |
if ( data !== undefined ) |
jQuery.cache[ id ][ name ] = data; |
if ( data !== undefined ) thisCache[ name ] = data; |
|
// Return the named cache data, or the ID for the element |
return name ? |
jQuery.cache[ id ][ name ] : |
id; |
if(name === true) return thisCache |
else if(name) return thisCache[name] |
else return id |
}, |
|
removeData: function( elem, name ) { |
529,21 → 574,16 |
windowData : |
elem; |
|
var id = elem[ expando ]; |
var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; |
|
// If we want to remove a specific section of the element's data |
if ( name ) { |
if ( jQuery.cache[ id ] ) { |
if ( thisCache ) { |
// Remove the section of cache data |
delete jQuery.cache[ id ][ name ]; |
delete thisCache[ name ]; |
|
// If we've removed all the data, remove the element's cache |
name = ""; |
|
for ( name in jQuery.cache[ id ] ) |
break; |
|
if ( !name ) |
if( jQuery.isEmptyObject(thisCache) ) |
jQuery.removeData( elem ); |
} |
|
560,39 → 600,48 |
} |
|
// Completely remove the data cache |
delete jQuery.cache[ id ]; |
delete cache[ id ]; |
} |
}, |
queue: function( elem, type, data ) { |
if ( elem ){ |
if( !elem ) return; |
|
type = (type || "fx") + "queue"; |
type = (type || "fx") + "queue"; |
var q = jQuery.data( elem, type ); |
|
var q = jQuery.data( elem, type ); |
// Speed up dequeue by getting out quickly if this is just a lookup |
if( !data ) return q || []; |
|
if ( !q || jQuery.isArray(data) ) |
q = jQuery.data( elem, type, jQuery.makeArray(data) ); |
else if( data ) |
q.push( data ); |
if ( !q || jQuery.isArray(data) ) |
q = jQuery.data( elem, type, jQuery.makeArray(data) ); |
else |
q.push( data ); |
|
} |
return q; |
}, |
|
dequeue: function( elem, type ){ |
var queue = jQuery.queue( elem, type ), |
fn = queue.shift(); |
type = type || "fx"; |
|
if( !type || type === "fx" ) |
fn = queue[0]; |
var queue = jQuery.queue( elem, type ), fn = queue.shift(); |
|
if( fn !== undefined ) |
fn.call(elem); |
// If the fx queue is dequeued, always remove the progress sentinel |
if( fn === "inprogress" ) fn = queue.shift(); |
|
if( fn ) { |
// Add a progress sentinel to prevent the fx queue from being |
// automatically dequeued |
if( type == "fx" ) queue.unshift("inprogress"); |
|
fn.call(elem, function() { jQuery.dequeue(elem, type); }); |
} |
} |
}); |
|
jQuery.fn.extend({ |
data: function( key, value ){ |
if(typeof key === "undefined" && this.length) return jQuery.data(this[0], true); |
|
var parts = key.split("."); |
parts[1] = parts[1] ? "." + parts[1] : ""; |
|
625,11 → 674,11 |
if ( data === undefined ) |
return jQuery.queue( this[0], type ); |
|
return this.each(function(){ |
return this.each(function(i, elem){ |
var queue = jQuery.queue( this, type, data ); |
|
if( type == "fx" && queue.length == 1 ) |
queue[0].call(this); |
if( type == "fx" && queue[0] !== "inprogress" ) |
jQuery.dequeue( this, type ) |
}); |
}, |
dequeue: function(type){ |
636,6 → 685,9 |
return this.each(function(){ |
jQuery.dequeue( this, type ); |
}); |
}, |
clearQueue: function(type){ |
return this.queue( type || "fx", [] ); |
} |
});/*! |
* Sizzle CSS Selector Engine - v1.0 |
971,7 → 1023,7 |
"": function(checkSet, part, isXML){ |
var doneName = done++, checkFn = dirCheck; |
|
if ( !part.match(/\W/) ) { |
if ( !/\W/.test(part) ) { |
var nodeCheck = part = isXML ? part : part.toUpperCase(); |
checkFn = dirNodeCheck; |
} |
981,7 → 1033,7 |
"~": function(checkSet, part, isXML){ |
var doneName = done++, checkFn = dirCheck; |
|
if ( typeof part === "string" && !part.match(/\W/) ) { |
if ( typeof part === "string" && !/\W/.test(part) ) { |
var nodeCheck = part = isXML ? part : part.toUpperCase(); |
checkFn = dirNodeCheck; |
} |
1074,7 → 1126,7 |
PSEUDO: function(match, curLoop, inplace, result, not){ |
if ( match[1] === "not" ) { |
// If we're dealing with a complex expression, or a simple one |
if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) { |
if ( chunker.exec(match[3]).length > 1 || /^\w/.test(match[3]) ) { |
match[3] = Sizzle(match[3], null, null, curLoop); |
} else { |
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); |
1300,7 → 1352,7 |
} |
|
var makeArray = function(array, results) { |
array = Array.prototype.slice.call( array ); |
array = Array.prototype.slice.call( array, 0 ); |
|
if ( results ) { |
results.push.apply( results, array ); |
1313,7 → 1365,7 |
// Perform a simple check to determine if the browser is capable of |
// converting a NodeList to an array using builtin methods. |
try { |
Array.prototype.slice.call( document.documentElement.childNodes ); |
Array.prototype.slice.call( document.documentElement.childNodes, 0 ); |
|
// Provide a fallback method if it does not work |
} catch(e){ |
1616,21 → 1668,17 |
jQuery.expr[":"] = jQuery.expr.filters; |
|
Sizzle.selectors.filters.hidden = function(elem){ |
var width = elem.offsetWidth, height = elem.offsetHeight; |
return ( width === 0 && height === 0 ) ? |
var width = elem.offsetWidth, height = elem.offsetHeight, |
force = /^tr$/i.test( elem.nodeName ); // ticket #4512 |
return ( width === 0 && height === 0 && !force ) ? |
true : |
( width !== 0 && height !== 0 ) ? |
false : |
!!( jQuery.curCSS(elem, "display") === "none" ); |
( width !== 0 && height !== 0 && !force ) ? |
false : |
!!( jQuery.curCSS(elem, "display") === "none" ); |
}; |
|
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 !Sizzle.selectors.filters.hidden(elem); |
}; |
|
Sizzle.selectors.filters.animated = function(elem){ |
1684,6 → 1732,27 |
window.Sizzle = Sizzle; |
|
})(); |
jQuery.winnow = function( elements, qualifier, keep ) { |
if(jQuery.isFunction( qualifier )) { |
return jQuery.grep(elements, function(elem, i) { |
return !!qualifier.call( elem, i ) === keep; |
}); |
} else if( qualifier.nodeType ) { |
return jQuery.grep(elements, function(elem, i) { |
return (elem === qualifier) === keep; |
}) |
} else if( typeof qualifier === "string" ) { |
var filtered = jQuery.grep(elements, function(elem) { return elem.nodeType === 1 }); |
|
if(isSimple.test( qualifier )) return jQuery.multiFilter(qualifier, filtered, !keep); |
else qualifier = jQuery.multiFilter( qualifier, elements ); |
} |
|
return jQuery.grep(elements, function(elem, i) { |
return (jQuery.inArray( elem, qualifier ) >= 0) === keep; |
}); |
} |
|
jQuery.fn.extend({ |
find: function( selector ) { |
var ret = this.pushStack( "", "find", selector ), length = 0; |
1708,25 → 1777,22 |
return ret; |
}, |
|
not: function( selector ) { |
return this.pushStack( jQuery.winnow(this, selector, false), "not", selector); |
}, |
|
filter: function( selector ) { |
return this.pushStack( |
jQuery.isFunction( selector ) && |
jQuery.grep(this, function(elem, i){ |
return selector.call( elem, i ); |
}) || |
|
jQuery.multiFilter( selector, jQuery.grep(this, function(elem){ |
return elem.nodeType === 1; |
}) ), "filter", selector ); |
return this.pushStack( jQuery.winnow(this, selector, true), "filter", selector ); |
}, |
|
closest: function( selector ) { |
var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, |
closer = 0; |
closer = 0, |
context = this.context; |
|
return this.map(function(){ |
var cur = this; |
while ( cur && cur.ownerDocument ) { |
while ( cur && cur.ownerDocument && cur !== context ) { |
if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { |
jQuery.data(cur, "closest", closer); |
return cur; |
1737,20 → 1803,6 |
}); |
}, |
|
not: function( selector ) { |
if ( typeof selector === "string" ) |
// test special case where just one selector is passed in |
if ( isSimple.test( selector ) ) |
return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector ); |
else |
selector = jQuery.multiFilter( selector, this ); |
|
var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; |
return this.filter(function() { |
return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; |
}); |
}, |
|
add: function( selector ) { |
return this.pushStack( jQuery.unique( jQuery.merge( |
this.get(), |
1803,37 → 1855,34 |
|
return this.pushStack( jQuery.unique( ret ), name, selector ); |
}; |
});jQuery.fn.extend({ |
}); |
jQuery.fn.extend({ |
attr: function( name, value ) { |
var options = name, isFunction = jQuery.isFunction( value ); |
var elem, options, isFunction = jQuery.isFunction(value); |
|
if ( typeof name === "string" ) { |
// Are we setting the attribute? |
if ( value === undefined ) { |
if ( typeof name === "string" ) { // A single attribute |
if ( value === undefined ) { // Query it on first element |
return this.length ? |
jQuery.attr( this[0], name ) : |
null; |
|
// Convert name, value params to options hash format |
} else { |
options = {}; |
options[ name ] = value; |
} else { // Set it on all elements |
for ( var i = 0, l = this.length; i < l; i++ ) { |
elem = this[i]; |
if ( isFunction ) |
value = value.call(elem,i); |
jQuery.attr( elem, name, value ); |
} |
} |
} |
|
// For each element... |
for ( var i = 0, l = this.length; i < l; i++ ) { |
var elem = this[i]; |
|
// Set all the attributes |
for ( var prop in options ) { |
value = options[prop]; |
|
if ( isFunction ) { |
value = value.call( elem, i ); |
} else { // Multiple attributes to set on all |
options = name; |
for ( var i = 0, l = this.length; i < l; i++ ) { |
elem = this[i]; |
for ( name in options ) { |
value = options[name]; |
if ( jQuery.isFunction(value) ) |
value = value.call(elem,i); |
jQuery.attr( elem, name, value ); |
} |
|
jQuery.attr( elem, prop, value ); |
} |
} |
|
1891,23 → 1940,31 |
return undefined; |
} |
|
// Typecast once if the value is a number |
if ( typeof value === "number" ) |
value += ''; |
|
var val = value; |
|
return this.each(function(){ |
if(jQuery.isFunction(value)) { |
val = value.call(this); |
// Typecast each time if the value is a Function and the appended |
// value is therefore different each time. |
if( typeof val === "number" ) val += ''; |
} |
|
if ( this.nodeType != 1 ) |
return; |
|
if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) |
this.checked = (jQuery.inArray(this.value, value) >= 0 || |
jQuery.inArray(this.name, value) >= 0); |
if ( jQuery.isArray(val) && /radio|checkbox/.test( this.type ) ) |
this.checked = jQuery.inArray(this.value || this.name, val) >= 0; |
|
else if ( jQuery.nodeName( this, "select" ) ) { |
var values = jQuery.makeArray(value); |
var values = jQuery.makeArray(val); |
|
jQuery( "option", this ).each(function(){ |
this.selected = (jQuery.inArray( this.value, values ) >= 0 || |
jQuery.inArray( this.text, values ) >= 0); |
this.selected = jQuery.inArray( this.value || this.text, values ) >= 0; |
}); |
|
if ( !values.length ) |
1914,7 → 1971,7 |
this.selectedIndex = -1; |
|
} else |
this.value = value; |
this.value = val; |
}); |
} |
}); |
1991,7 → 2048,7 |
if (!elem || elem.nodeType == 3 || elem.nodeType == 8) |
return undefined; |
|
var notxml = !elem.tagName || !jQuery.isXMLDoc( elem ), |
var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), |
// Whether we are setting (or getting) |
set = value !== undefined; |
|
1999,7 → 2056,7 |
name = notxml && jQuery.props[ name ] || name; |
|
// Only do all the following if this is a node (faster for style) |
if ( elem.tagName ) { |
if ( elem.nodeType === 1 ) { |
|
// These attributes require special treatment |
var special = /href|src|style/.test( name ); |
2013,7 → 2070,7 |
if ( name in elem && notxml && !special ) { |
if ( set ){ |
// We can't allow the type property to be changed (since it causes problems in IE) |
if ( name == "type" && elem.nodeName.match(/(button|input)/i) && elem.parentNode ) |
if ( name == "type" && /(button|input)/i.test(elem.nodeName) && elem.parentNode ) |
throw "type property can't be changed"; |
|
elem[ name ] = value; |
2029,9 → 2086,9 |
var attributeNode = elem.getAttributeNode( "tabIndex" ); |
return attributeNode && attributeNode.specified |
? attributeNode.value |
: elem.nodeName.match(/(button|input|object|select|textarea)/i) |
: /(button|input|object|select|textarea)/i.test(elem.nodeName) |
? 0 |
: elem.nodeName.match(/^(a|area)$/i) && elem.href |
: /^(a|area)$/i.test(elem.nodeName) && elem.href |
? 0 |
: undefined; |
} |
2063,9 → 2120,23 |
// Using attr for specific style information is now deprecated. Use style insead. |
return jQuery.style(elem, name, value); |
} |
});jQuery.fn.extend({ |
}); |
var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, |
rleadingWhitespace = /^\s+/, |
rsingleTag = /^<(\w+)\s*\/?>$/, |
rxhtmlTag = /(<(\w+)[^>]*?)\/>/g, |
rselfClosing = /^(?:abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i, |
rinsideTable = /^<(thead|tbody|tfoot|colg|cap)/, |
rtbody = /<tbody/i, |
fcloseTag = function(all, front, tag){ |
return rselfClosing.test(tag) ? |
all : |
front + "></" + tag + ">"; |
}; |
|
jQuery.fn.extend({ |
text: function( text ) { |
if ( typeof text !== "object" && text != null ) |
if ( typeof text !== "object" && text !== undefined ) |
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); |
|
var ret = ""; |
2072,10 → 2143,11 |
|
jQuery.each( text || this, function(){ |
jQuery.each( this.childNodes, function(){ |
if ( this.nodeType != 8 ) |
ret += this.nodeType != 1 ? |
if ( this.nodeType !== 8 ) { |
ret += this.nodeType !== 1 ? |
this.nodeValue : |
jQuery.fn.text( [ this ] ); |
} |
}); |
}); |
|
2083,18 → 2155,26 |
}, |
|
wrapAll: function( html ) { |
if ( jQuery.isFunction( html ) ) { |
return this.each(function() { |
jQuery(this).wrapAll( html.apply(this, arguments) ); |
}); |
} |
|
if ( this[0] ) { |
// The elements to wrap the target around |
var wrap = jQuery( html, this[0].ownerDocument ).clone(); |
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(); |
|
if ( this[0].parentNode ) |
if ( this[0].parentNode ) { |
wrap.insertBefore( this[0] ); |
} |
|
wrap.map(function(){ |
var elem = this; |
|
while ( elem.firstChild ) |
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { |
elem = elem.firstChild; |
} |
|
return elem; |
}).append(this); |
2117,15 → 2197,17 |
|
append: function() { |
return this.domManip(arguments, true, function(elem){ |
if (this.nodeType == 1) |
if ( this.nodeType === 1 ) { |
this.appendChild( elem ); |
} |
}); |
}, |
|
prepend: function() { |
return this.domManip(arguments, true, function(elem){ |
if (this.nodeType == 1) |
if ( this.nodeType === 1 ) { |
this.insertBefore( elem, this.firstChild ); |
} |
}); |
}, |
|
2160,9 → 2242,11 |
html = div.innerHTML; |
} |
|
return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")], ownerDocument)[0]; |
} else |
return jQuery.clean([html.replace(rinlinejQuery, "") |
.replace(rleadingWhitespace, "")], ownerDocument)[0]; |
} else { |
return this.cloneNode(true); |
} |
}); |
|
// Copy the events from the original to the clone |
2170,8 → 2254,7 |
var orig = this.find("*").andSelf(), i = 0; |
|
ret.find("*").andSelf().each(function(){ |
if ( this.nodeName !== orig[i].nodeName ) |
return; |
if ( this.nodeName !== orig[i].nodeName ) { return; } |
|
var events = jQuery.data( orig[i], "events" ); |
|
2192,7 → 2275,7 |
html: function( value ) { |
return value === undefined ? |
(this[0] ? |
this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : |
this[0].innerHTML.replace(rinlinejQuery, "") : |
null) : |
this.empty().append( value ); |
}, |
2201,25 → 2284,68 |
return this.after( value ).remove(); |
}, |
|
detach: function( selector ) { |
return this.remove( selector, true ); |
}, |
|
domManip: function( args, table, callback ) { |
var fragment, scripts, cacheable, cached, cacheresults, first, |
value = args[0]; |
|
if ( jQuery.isFunction(value) ) { |
return this.each(function() { |
args[0] = value.call(this); |
return jQuery(this).domManip( args, table, callback ); |
}); |
} |
|
if ( this[0] ) { |
var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), |
scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), |
first = fragment.firstChild; |
if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && args[0].indexOf("<option") < 0 ) { |
cacheable = true; |
cacheresults = jQuery.fragments[ args[0] ]; |
if ( cacheresults ) { |
if ( cacheresults !== 1 ) { |
fragment = cacheresults; |
} |
cached = true; |
} |
} |
|
if ( first ) |
for ( var i = 0, l = this.length; i < l; i++ ) |
callback.call( root(this[i], first), this.length > 1 || i > 0 ? |
fragment.cloneNode(true) : fragment ); |
if ( !fragment ) { |
fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(); |
scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ); |
} |
|
if ( scripts ) |
first = fragment.firstChild; |
|
if ( first ) { |
table = table && jQuery.nodeName( first, "tr" ); |
|
for ( var i = 0, l = this.length; i < l; i++ ) { |
callback.call( |
table ? |
root(this[i], first) : |
this[i], |
cacheable || this.length > 1 || i > 0 ? |
fragment.cloneNode(true) : |
fragment |
); |
} |
} |
|
if ( scripts ) { |
jQuery.each( scripts, evalScript ); |
} |
|
if ( cacheable ) { |
jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1; |
} |
} |
|
return this; |
|
function root( elem, cur ) { |
return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? |
return jQuery.nodeName(elem, "table") ? |
(elem.getElementsByTagName("tbody")[0] || |
elem.appendChild(elem.ownerDocument.createElement("tbody"))) : |
elem; |
2227,6 → 2353,8 |
} |
}); |
|
jQuery.fragments = {}; |
|
jQuery.each({ |
appendTo: "append", |
prependTo: "prepend", |
2248,14 → 2376,15 |
}); |
|
jQuery.each({ |
remove: function( selector ) { |
// keepData is for internal use only--do not document |
remove: function( selector, keepData ) { |
if ( !selector || jQuery.multiFilter( selector, [ this ] ).length ) { |
if ( this.nodeType === 1 ) { |
if ( !keepData && this.nodeType === 1 ) { |
cleanData( jQuery("*", this).add(this) ); |
} |
|
if ( this.parentNode ) { |
this.parentNode.removeChild( this ); |
this.parentNode.removeChild( this ); |
} |
} |
}, |
2282,37 → 2411,36 |
context = context || document; |
|
// !context.createElement fails in IE with an error but returns typeof 'object' |
if ( typeof context.createElement === "undefined" ) |
if ( typeof context.createElement === "undefined" ) { |
context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
} |
|
// If a single string is passed in and it's a single tag |
// just do a createElement and skip the rest |
if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { |
var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); |
if ( match ) |
var match = rsingleTag.exec(elems[0]); |
if ( match ) { |
return [ context.createElement( match[1] ) ]; |
} |
} |
|
var ret = [], scripts = [], div = context.createElement("div"); |
|
jQuery.each(elems, function(i, elem){ |
if ( typeof elem === "number" ) |
if ( typeof elem === "number" ) { |
elem += ''; |
} |
|
if ( !elem ) |
return; |
if ( !elem ) { return; } |
|
// Convert html string into DOM nodes |
if ( typeof elem === "string" ) { |
// Fix "XHTML"-style tags in all browsers |
elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ |
return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? |
all : |
front + "></" + tag + ">"; |
}); |
elem = elem.replace(rxhtmlTag, fcloseTag); |
|
// Trim whitespace, otherwise indexOf won't work as expected |
var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(); |
var tags = elem.replace(rleadingWhitespace, "") |
.substring(0, 10).toLowerCase(); |
|
var wrap = |
// option or optgroup |
2322,7 → 2450,7 |
!tags.indexOf("<leg") && |
[ 1, "<fieldset>", "</fieldset>" ] || |
|
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && |
rinsideTable.test(tags) && |
[ 1, "<table>", "</table>" ] || |
|
!tags.indexOf("<tr") && |
2345,39 → 2473,44 |
div.innerHTML = wrap[1] + elem + wrap[2]; |
|
// Move to the right depth |
while ( wrap[0]-- ) |
while ( wrap[0]-- ) { |
div = div.lastChild; |
} |
|
// Remove IE's autoinserted <tbody> from table fragments |
if ( !jQuery.support.tbody ) { |
|
// String was a <table>, *may* have spurious <tbody> |
var hasBody = /<tbody/i.test(elem), |
var hasBody = rtbody.test(elem), |
tbody = !tags.indexOf("<table") && !hasBody ? |
div.firstChild && div.firstChild.childNodes : |
|
// String was a bare <thead> or <tfoot> |
wrap[1] == "<table>" && !hasBody ? |
div.childNodes : |
[]; |
// String was a bare <thead> or <tfoot> |
wrap[1] == "<table>" && !hasBody ? |
div.childNodes : |
[]; |
|
for ( var j = tbody.length - 1; j >= 0 ; --j ) |
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) |
for ( var j = tbody.length - 1; j >= 0 ; --j ) { |
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { |
tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
|
} |
} |
|
} |
|
// IE completely kills leading whitespace when innerHTML is used |
if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) ) |
div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); |
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { |
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); |
} |
|
elem = jQuery.makeArray( div.childNodes ); |
} |
|
if ( elem.nodeType ) |
if ( elem.nodeType ) { |
ret.push( elem ); |
else |
} else { |
ret = jQuery.merge( ret, elem ); |
} |
|
}); |
|
2386,8 → 2519,9 |
if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { |
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); |
} else { |
if ( ret[i].nodeType === 1 ) |
if ( ret[i].nodeType === 1 ) { |
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); |
} |
fragment.appendChild( ret[i] ); |
} |
} |
2466,7 → 2600,7 |
// Namespaced event handlers |
var namespaces = type.split("."); |
type = namespaces.shift(); |
handler.type = namespaces.slice().sort().join("."); |
handler.type = namespaces.slice(0).sort().join("."); |
|
// Get the current list of functions bound to this event |
var handlers = events[ type ], |
2542,7 → 2676,7 |
var namespaces = type.split("."); |
type = namespaces.shift(); |
var all = !namespaces.length, |
namespace = new RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"), |
namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join(".*\\.") + "(\\.|$)"), |
special = this.special[ type ] || {}; |
|
if ( events[ type ] ) { |
2700,7 → 2834,7 |
// Cache this now, all = true means, any handler |
all = !namespaces.length && !event.exclusive; |
|
var namespace = new RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)"); |
var namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join(".*\\.") + "(\\.|$)"); |
|
handlers = ( jQuery.data(this, "events") || {} )[ event.type ]; |
|
3124,6 → 3258,12 |
if ( readyBound ) return; |
readyBound = true; |
|
// Catch cases where $(document).ready() is called after the |
// browser event has already occurred. |
if ( document.readyState === "complete" ) { |
return jQuery.ready(); |
} |
|
// Mozilla, Opera and webkit nightlies currently support this event |
if ( document.addEventListener ) { |
// Use the handy event callback |
3300,11 → 3440,22 |
tabindex: "tabIndex" |
}; |
// exclude the following css properties to add px |
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, |
var rexclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, |
ralpha = /alpha\([^)]*\)/, |
ropacity = /opacity=([^)]*)/, |
rfloat = /float/i, |
rdashAlpha = /-([a-z])/ig, |
rupper = /([A-Z])/g, |
rnumpx = /^\d+(?:px)?$/i, |
rnum = /^\d/, |
|
// cache check for defaultView.getComputedStyle |
getComputedStyle = document.defaultView && document.defaultView.getComputedStyle, |
// normalize float css property |
styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat"; |
styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat", |
fcamelCase = function(all, letter){ |
return letter.toUpperCase(); |
}; |
|
jQuery.fn.css = function( name, value ) { |
var options = name, isFunction = jQuery.isFunction( value ); |
3322,6 → 3473,14 |
options[ name ] = value; |
} |
} |
|
var isFunction = {}; |
|
// For each value, determine whether it's a Function so we don't |
// need to determine it again for each element |
for ( var prop in options ) { |
isFunction[prop] = jQuery.isFunction( options[prop] ); |
} |
|
// For each element... |
for ( var i = 0, l = this.length; i < l; i++ ) { |
3331,11 → 3490,11 |
for ( var prop in options ) { |
value = options[prop]; |
|
if ( isFunction ) { |
if ( isFunction[prop] ) { |
value = value.call( elem, i ); |
} |
|
if ( typeof value === "number" && !exclude.test(prop) ) { |
if ( typeof value === "number" && !rexclude.test(prop) ) { |
value = value + "px"; |
} |
|
3349,17 → 3508,19 |
jQuery.extend({ |
style: function( elem, name, value ) { |
// don't set styles on text and comment nodes |
if (!elem || elem.nodeType == 3 || elem.nodeType == 8) |
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { |
return undefined; |
} |
|
// ignore negative width and height values #1599 |
if ( (name == 'width' || name == 'height') && parseFloat(value) < 0 ) |
if ( (name === "width" || name === "height") && parseFloat(value) < 0 ) { |
value = undefined; |
} |
|
var style = elem.style || elem, set = value !== undefined; |
|
// IE uses filters for opacity |
if ( !jQuery.support.opacity && name == "opacity" ) { |
if ( !jQuery.support.opacity && name === "opacity" ) { |
if ( set ) { |
// IE has trouble with opacity if it does not have layout |
// Force it by setting the zoom level |
3366,53 → 3527,56 |
style.zoom = 1; |
|
// Set the alpha filter to set the opacity |
style.filter = (style.filter || "").replace( /alpha\([^)]*\)/, "" ) + |
(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); |
style.filter = (style.filter || "").replace( ralpha, "" ) + |
(parseInt( value ) + '' === "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); |
} |
|
return style.filter && style.filter.indexOf("opacity=") >= 0 ? |
(parseFloat( style.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '': |
(parseFloat( ropacity.exec(style.filter)[1] ) / 100) + '': |
""; |
} |
|
// Make sure we're using the right name for getting the float value |
if ( /float/i.test( name ) ) |
if ( rfloat.test( name ) ) { |
name = styleFloat; |
} |
|
name = name.replace(/-([a-z])/ig, function(all, letter){ |
return letter.toUpperCase(); |
}); |
name = name.replace(rdashAlpha, fcamelCase); |
|
if ( set ) |
if ( set ) { |
style[ name ] = value; |
} |
|
return style[ name ]; |
}, |
|
css: function( elem, name, force, extra ) { |
if ( name == "width" || name == "height" ) { |
var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; |
if ( name === "width" || name === "height" ) { |
var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name === "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; |
|
function getWH() { |
val = name == "width" ? elem.offsetWidth : elem.offsetHeight; |
val = name === "width" ? elem.offsetWidth : elem.offsetHeight; |
|
if ( extra === "border" ) |
return; |
if ( extra === "border" ) { return; } |
|
jQuery.each( which, function() { |
if ( !extra ) |
if ( !extra ) { |
val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; |
if ( extra === "margin" ) |
} |
|
if ( extra === "margin" ) { |
val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; |
else |
} else { |
val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; |
} |
}); |
} |
|
if ( elem.offsetWidth !== 0 ) |
if ( elem.offsetWidth !== 0 ) { |
getWH(); |
else |
} else { |
jQuery.swap( elem, props, getWH ); |
} |
|
return Math.max(0, Math.round(val)); |
} |
3425,7 → 3589,7 |
|
// IE uses filters for opacity |
if ( !jQuery.support.opacity && name === "opacity" && elem.currentStyle ) { |
ret = (elem.currentStyle.filter || "").match(/opacity=([^)]*)/) ? |
ret = ropacity.test(elem.currentStyle.filter || "") ? |
(parseFloat(RegExp.$1) / 100) + "" : |
""; |
|
3435,8 → 3599,9 |
} |
|
// Make sure we're using the right name for getting the float value |
if ( /float/i.test( name ) ) |
if ( rfloat.test( name ) ) { |
name = styleFloat; |
} |
|
if ( !force && style && style[ name ] ) { |
ret = style[ name ]; |
3444,24 → 3609,25 |
} else if ( getComputedStyle ) { |
|
// Only "float" is needed here |
if ( /float/i.test( name ) ) |
if ( rfloat.test( name ) ) { |
name = "float"; |
} |
|
name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); |
name = name.replace( rupper, "-$1" ).toLowerCase(); |
|
var computedStyle = elem.ownerDocument.defaultView.getComputedStyle( elem, null ); |
|
if ( computedStyle ) |
if ( computedStyle ) { |
ret = computedStyle.getPropertyValue( name ); |
} |
|
// We should always get a number back from opacity |
if ( name == "opacity" && ret == "" ) |
if ( name === "opacity" && ret === "" ) { |
ret = "1"; |
} |
|
} else if ( elem.currentStyle ) { |
var camelCase = name.replace(/\-(\w)/g, function(all, letter){ |
return letter.toUpperCase(); |
}); |
var camelCase = name.replace(rdashAlpha, fcamelCase); |
|
ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; |
|
3470,7 → 3636,7 |
|
// If we're not dealing with a regular pixel number |
// but a number that has a weird ending, we need to convert it to pixels |
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { |
if ( !rnumpx.test( ret ) && rnum.test( ret ) ) { |
// Remember the original values |
var left = style.left, rsLeft = elem.runtimeStyle.left; |
|
3491,6 → 3657,7 |
// A method for quickly swapping in/out CSS properties to get correct calculations |
swap: function( elem, options, callback ) { |
var old = {}; |
|
// Remember the old values, and insert the new ones |
for ( var name in options ) { |
old[ name ] = elem.style[ name ]; |
3500,16 → 3667,29 |
callback.call( elem ); |
|
// Revert the old values |
for ( var name in options ) |
for ( var name in options ) { |
elem.style[ name ] = old[ name ]; |
} |
} |
});jQuery.fn.extend({ |
}); |
var jsc = now(), |
rscript = /<script(.|\s)*?\/script>/g, |
rselectTextarea = /select|textarea/i, |
rinput = /text|hidden|password|search/i, |
jsre = /=\?(&|$)/, |
rquery = /\?/, |
rts = /(\?|&)_=.*?(&|$)/, |
rurl = /^(\w+:)?\/\/([^\/?#]+)/, |
r20 = /%20/g; |
|
jQuery.fn.extend({ |
// Keep a copy of the old load |
_load: jQuery.fn.load, |
|
load: function( url, params, callback ) { |
if ( typeof url !== "string" ) |
if ( typeof url !== "string" ) { |
return this._load( url ); |
} |
|
var off = url.indexOf(" "); |
if ( off >= 0 ) { |
3521,7 → 3701,7 |
var type = "GET"; |
|
// If the second parameter was provided |
if ( params ) |
if ( params ) { |
// If it's a function |
if ( jQuery.isFunction( params ) ) { |
// We assume that it's the callback |
3529,10 → 3709,11 |
params = null; |
|
// Otherwise, build a param string |
} else if( typeof params === "object" ) { |
} else if ( typeof params === "object" ) { |
params = jQuery.param( params ); |
type = "POST"; |
} |
} |
|
var self = this; |
|
3544,7 → 3725,7 |
data: params, |
complete: function(res, status){ |
// If successful, inject the HTML into all the matched elements |
if ( status == "success" || status == "notmodified" ) |
if ( status === "success" || status === "notmodified" ) { |
// See if a selector was specified |
self.html( selector ? |
// Create a dummy div to hold the results |
3551,7 → 3732,7 |
jQuery("<div/>") |
// inject the contents of the document in, removing the scripts |
// to avoid any 'Permission Denied' errors in IE |
.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")) |
.append(res.responseText.replace(rscript, "")) |
|
// Locate the specified elements |
.find(selector) : |
3558,11 → 3739,14 |
|
// If not, just inject the full result |
res.responseText ); |
} |
|
if( callback ) |
if ( callback ) { |
self.each( callback, [res.responseText, status, res] ); |
} |
} |
}); |
|
return this; |
}, |
|
3575,12 → 3759,14 |
}) |
.filter(function(){ |
return this.name && !this.disabled && |
(this.checked || /select|textarea/i.test(this.nodeName) || |
/text|hidden|password|search/i.test(this.type)); |
(this.checked || rselectTextarea.test(this.nodeName) || |
rinput.test(this.type)); |
}) |
.map(function(i, elem){ |
var val = jQuery(this).val(); |
return val == null ? null : |
|
return val == null ? |
null : |
jQuery.isArray(val) ? |
jQuery.map( val, function(val, i){ |
return {name: elem.name, value: val}; |
3597,8 → 3783,6 |
}; |
}); |
|
var jsc = now(); |
|
jQuery.extend({ |
|
get: function( url, data, callback, type ) { |
3660,8 → 3844,10 |
// Create the request object; Microsoft failed to properly |
// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available |
// This function can be overriden by calling jQuery.ajaxSetup |
xhr:function(){ |
return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); |
xhr: function(){ |
return window.ActiveXObject ? |
new ActiveXObject("Microsoft.XMLHTTP") : |
new XMLHttpRequest(); |
}, |
accepts: { |
xml: "application/xml, text/xml", |
3682,30 → 3868,35 |
// checked again later (in the test suite, specifically) |
s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); |
|
var jsonp, jsre = /=\?(&|$)/g, status, data, |
var jsonp, status, data, |
type = s.type.toUpperCase(); |
|
// convert data if not already a string |
if ( s.data && s.processData && typeof s.data !== "string" ) |
if ( s.data && s.processData && typeof s.data !== "string" ) { |
s.data = jQuery.param(s.data); |
} |
|
// Handle JSONP Parameter Callbacks |
if ( s.dataType == "jsonp" ) { |
if ( type == "GET" ) { |
if ( !s.url.match(jsre) ) |
s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?"; |
} else if ( !s.data || !s.data.match(jsre) ) |
if ( s.dataType === "jsonp" ) { |
if ( type === "GET" ) { |
if ( !jsre.test( s.url ) ) { |
s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?"; |
} |
} else if ( !s.data || !jsre.test(s.data) ) { |
s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; |
} |
s.dataType = "json"; |
} |
|
// Build temporary JSONP function |
if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { |
if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) { |
jsonp = "jsonp" + jsc++; |
|
// Replace the =? sequence both in the query string and the data |
if ( s.data ) |
if ( s.data ) { |
s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); |
} |
|
s.url = s.url.replace(jsre, "=" + jsonp + "$1"); |
|
// We need to make sure |
3720,44 → 3911,50 |
// Garbage collect |
window[ jsonp ] = undefined; |
try{ delete window[ jsonp ]; } catch(e){} |
if ( head ) |
if ( head ) { |
head.removeChild( script ); |
} |
}; |
} |
|
if ( s.dataType == "script" && s.cache == null ) |
if ( s.dataType === "script" && s.cache === null ) { |
s.cache = false; |
} |
|
if ( s.cache === false && type == "GET" ) { |
if ( s.cache === false && type === "GET" ) { |
var ts = now(); |
|
// try replacing _= if it is there |
var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2"); |
var ret = s.url.replace(rts, "$1_=" + ts + "$2"); |
|
// if nothing was replaced, add timestamp to the end |
s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); |
s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : ""); |
} |
|
// If data is available, append data to url for get requests |
if ( s.data && type == "GET" ) { |
s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; |
if ( s.data && type === "GET" ) { |
s.url += (rquery.test(s.url) ? "&" : "?") + s.data; |
} |
|
// Watch for a new set of requests |
if ( s.global && ! jQuery.active++ ) |
if ( s.global && ! jQuery.active++ ) { |
jQuery.event.trigger( "ajaxStart" ); |
} |
|
// Matches an absolute URL, and saves the domain |
var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url ); |
var parts = rurl.exec( s.url ); |
|
// If we're requesting a remote document |
// and trying to load JSON or Script with a GET |
if ( s.dataType == "script" && type == "GET" && parts |
&& ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){ |
if ( s.dataType === "script" && type === "GET" && parts |
&& ( parts[1] && parts[1] !== location.protocol || parts[2] !== location.host )) { |
|
var head = document.getElementsByTagName("head")[0]; |
var script = document.createElement("script"); |
script.src = s.url; |
if (s.scriptCharset) |
if ( s.scriptCharset ) { |
script.charset = s.scriptCharset; |
} |
|
// Handle Script loading |
if ( !jsonp ) { |
3766,7 → 3963,7 |
// Attach handlers for all browsers |
script.onload = script.onreadystatechange = function(){ |
if ( !done && (!this.readyState || |
this.readyState == "loaded" || this.readyState == "complete") ) { |
this.readyState === "loaded" || this.readyState === "complete") ) { |
done = true; |
success(); |
complete(); |
3773,7 → 3970,9 |
|
// Handle memory leak in IE |
script.onload = script.onreadystatechange = null; |
head.removeChild( script ); |
if ( head && script.parentNode ) { |
head.removeChild( script ); |
} |
} |
}; |
} |
3793,23 → 3992,28 |
|
// Open the socket |
// Passing null username, generates a login popup on Opera (#2865) |
if( s.username ) |
if ( s.username ) { |
xhr.open(type, s.url, s.async, s.username, s.password); |
else |
} else { |
xhr.open(type, s.url, s.async); |
} |
|
// Need an extra try/catch for cross domain requests in Firefox 3 |
try { |
// Set the correct header, if data is being sent |
if ( s.data ) |
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]) |
if ( jQuery.lastModified[s.url] ) { |
xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]); |
if (jQuery.etag[s.url]) |
} |
|
if ( jQuery.etag[s.url] ) { |
xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]); |
} |
} |
|
// Set header so the called script knows that it's an XMLHttpRequest |
3824,30 → 4028,36 |
// Allow custom headers/mimetypes and early abort |
if ( s.beforeSend && s.beforeSend(xhr, s) === false ) { |
// Handle the global AJAX counter |
if ( s.global && ! --jQuery.active ) |
if ( s.global && ! --jQuery.active ) { |
jQuery.event.trigger( "ajaxStop" ); |
} |
|
// close opended socket |
xhr.abort(); |
return false; |
} |
|
if ( s.global ) |
if ( s.global ) { |
jQuery.event.trigger("ajaxSend", [xhr, s]); |
} |
|
// Wait for a response to come back |
var onreadystatechange = function(isTimeout){ |
// The request was aborted, clear the interval and decrement jQuery.active |
if (xhr.readyState == 0) { |
if (ival) { |
if ( xhr.readyState === 0 ) { |
if ( ival ) { |
// clear poll interval |
clearInterval(ival); |
clearInterval( ival ); |
ival = null; |
|
// Handle the global AJAX counter |
if ( s.global && ! --jQuery.active ) |
if ( s.global && ! --jQuery.active ) { |
jQuery.event.trigger( "ajaxStop" ); |
} |
} |
|
// The transfer is complete and the data is available, or the request timed out |
} else if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) { |
} else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) { |
requestDone = true; |
|
// clear poll interval |
3856,12 → 4066,15 |
ival = null; |
} |
|
status = isTimeout == "timeout" ? "timeout" : |
!jQuery.httpSuccess( xhr ) ? "error" : |
s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? "notmodified" : |
"success"; |
status = isTimeout === "timeout" ? |
"timeout" : |
!jQuery.httpSuccess( xhr ) ? |
"error" : |
s.ifModified && jQuery.httpNotModified( xhr, s.url ) ? |
"notmodified" : |
"success"; |
|
if ( status == "success" ) { |
if ( status === "success" ) { |
// Watch for, and catch, XML document parse errors |
try { |
// process the data (runs the xml through httpData regardless of callback) |
3872,22 → 4085,26 |
} |
|
// Make sure that the request was successful or notmodified |
if ( status == "success" || status == "notmodified" ) { |
if ( status === "success" || status === "notmodified" ) { |
// JSONP handles its own success callback |
if ( !jsonp ) |
if ( !jsonp ) { |
success(); |
} else |
} |
} else { |
jQuery.handleError(s, xhr, status); |
} |
|
// Fire the complete handlers |
complete(); |
|
if ( isTimeout ) |
if ( isTimeout ) { |
xhr.abort(); |
} |
|
// Stop memory leaks |
if ( s.async ) |
if ( s.async ) { |
xhr = null; |
} |
} |
}; |
|
3896,47 → 4113,55 |
var ival = setInterval(onreadystatechange, 13); |
|
// Timeout checker |
if ( s.timeout > 0 ) |
if ( s.timeout > 0 ) { |
setTimeout(function(){ |
// Check to see if the request is still happening |
if ( xhr && !requestDone ) |
if ( xhr && !requestDone ) { |
onreadystatechange( "timeout" ); |
} |
}, s.timeout); |
} |
} |
|
// Send the data |
try { |
xhr.send( type === "POST" ? s.data : null ); |
xhr.send( type === "POST" || type === "PUT" ? s.data : null ); |
} catch(e) { |
jQuery.handleError(s, xhr, null, e); |
} |
|
// firefox 1.5 doesn't fire statechange for sync requests |
if ( !s.async ) |
if ( !s.async ) { |
onreadystatechange(); |
} |
|
function success(){ |
// If a local callback was specified, fire it and pass it the data |
if ( s.success ) |
if ( s.success ) { |
s.success( data, status ); |
} |
|
// Fire the global callback |
if ( s.global ) |
if ( s.global ) { |
jQuery.event.trigger( "ajaxSuccess", [xhr, s] ); |
} |
} |
|
function complete(){ |
// Process result |
if ( s.complete ) |
if ( s.complete ) { |
s.complete(xhr, status); |
} |
|
// The request was completed |
if ( s.global ) |
if ( s.global ) { |
jQuery.event.trigger( "ajaxComplete", [xhr, s] ); |
} |
|
// Handle the global AJAX counter |
if ( s.global && ! --jQuery.active ) |
if ( s.global && ! --jQuery.active ) { |
jQuery.event.trigger( "ajaxStop" ); |
} |
} |
|
// return XMLHttpRequest to allow aborting the request etc. |
3945,11 → 4170,14 |
|
handleError: function( s, xhr, status, e ) { |
// If a local callback was specified, fire it |
if ( s.error ) s.error( xhr, status, e ); |
if ( s.error ) { |
s.error( xhr, status, e ); |
} |
|
// Fire the global callback |
if ( s.global ) |
if ( s.global ) { |
jQuery.event.trigger( "ajaxError", [xhr, s, e] ); |
} |
}, |
|
// Counter for holding the number of active queries |
3959,37 → 4187,43 |
httpSuccess: function( xhr ) { |
try { |
// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 |
return !xhr.status && location.protocol == "file:" || |
( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223; |
return !xhr.status && location.protocol === "file:" || |
// Opera returns 0 when status is 304 |
( xhr.status >= 200 && xhr.status < 300 ) || |
xhr.status === 304 || xhr.status === 1223 || xhr.status === 0; |
} catch(e){} |
|
return false; |
}, |
|
// Determines if an XMLHttpRequest returns NotModified |
httpNotModified: function( xhr, url ) { |
var last_modified = xhr.getResponseHeader("Last-Modified"); |
var etag = xhr.getResponseHeader("Etag"); |
var last_modified = xhr.getResponseHeader("Last-Modified"), |
etag = xhr.getResponseHeader("Etag"); |
|
if (last_modified) |
if ( last_modified ) { |
jQuery.lastModified[url] = last_modified; |
} |
|
if (etag) |
if ( etag ) { |
jQuery.etag[url] = etag; |
} |
|
return xhr.status == 304; |
// Opera returns 0 when status is 304 |
return xhr.status === 304 || xhr.status === 0; |
}, |
|
httpData: function( xhr, type, s ) { |
var ct = xhr.getResponseHeader("content-type"), |
xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0, |
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.nodeName === "parsererror" ) { |
throw "parsererror"; |
} |
|
// Allow a pre-filtering function to sanitize the response |
// s != null is checked to keep backwards compatibility |
// s is checked to keep backwards compatibility |
if ( s && s.dataFilter ) { |
data = s.dataFilter( data, type ); |
} |
4003,7 → 4237,7 |
} |
|
// Get the JavaScript object, if JSON is used. |
if ( type == "json" ) { |
if ( type === "json" ) { |
if ( typeof JSON === "object" && JSON.parse ) { |
data = JSON.parse( data ); |
} else { |
4018,15 → 4252,15 |
// Serialize an array of form elements or a set of |
// key/values into a query string |
param: function( a ) { |
var s = [ ]; |
var s = []; |
|
function add( key, 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 ) |
if ( jQuery.isArray(a) || a.jquery ) { |
// Serialize the form elements |
jQuery.each( a, function(){ |
add( this.name, this.value ); |
4033,19 → 4267,22 |
}); |
|
// Otherwise, assume that it's an object of key/value pairs |
else |
} else { |
// Serialize the key/values |
for ( var j in a ) |
for ( var j in a ) { |
// If the value is an array then the key names need to be repeated |
if ( jQuery.isArray(a[j]) ) |
if ( jQuery.isArray(a[j]) ) { |
jQuery.each( a[j], function(){ |
add( j, this ); |
}); |
else |
} else { |
add( j, jQuery.isFunction(a[j]) ? a[j]() : a[j] ); |
} |
} |
} |
|
// Return the resulting serialization |
return s.join("&").replace(/%20/g, "+"); |
return s.join("&").replace(r20, "+"); |
} |
|
}); |
4079,12 → 4316,12 |
this[i].style.display = old || ""; |
|
if ( jQuery.css(this[i], "display") === "none" ) { |
var tagName = this[i].tagName, display; |
var nodeName = this[i].nodeName, display; |
|
if ( elemdisplay[ tagName ] ) { |
display = elemdisplay[ tagName ]; |
if ( elemdisplay[ nodeName ] ) { |
display = elemdisplay[ nodeName ]; |
} else { |
var elem = jQuery("<" + tagName + " />").appendTo("body"); |
var elem = jQuery("<" + nodeName + " />").appendTo("body"); |
|
display = elem.css("display"); |
if ( display === "none" ) |
4092,7 → 4329,7 |
|
elem.remove(); |
|
elemdisplay[ tagName ] = display; |
elemdisplay[ nodeName ] = display; |
} |
|
jQuery.data(this[i], "olddisplay", display); |
4160,6 → 4397,14 |
self = this; |
|
for ( p in prop ) { |
var name = p.replace(rdashAlpha, fcamelCase); |
|
if ( p !== name ) { |
prop[ name ] = prop[ p ]; |
delete prop[ p ]; |
p = name; |
} |
|
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) |
return opt.complete.call(this); |
|
4183,7 → 4428,7 |
if ( /toggle|show|hide/.test(val) ) |
e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); |
else { |
var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), |
var parts = /^([+-]=)?([\d+-.]+)(.*)$/.exec(val), |
start = e.cur(true) || 0; |
|
if ( parts ) { |
4463,11 → 4708,14 |
} |
} |
}); |
if ( "getBoundingClientRect" in document.documentElement ) |
if ( "getBoundingClientRect" in document.documentElement ) { |
jQuery.fn.offset = function() { |
var elem = this[0]; |
if ( !elem || !elem.ownerDocument ) return null; |
if ( elem === elem.ownerDocument.body ) return jQuery.offset.bodyOffset( elem ); |
if ( !elem || !elem.ownerDocument ) { return null; } |
if ( elem === elem.ownerDocument.body ) { |
return jQuery.offset.bodyOffset( elem ); |
} |
|
var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement, |
clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, |
top = box.top + (self.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop, |
4474,11 → 4722,14 |
left = box.left + (self.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; |
return { top: top, left: left }; |
}; |
else |
} else { |
jQuery.fn.offset = function() { |
var elem = this[0]; |
if ( !elem || !elem.ownerDocument ) return null; |
if ( elem === elem.ownerDocument.body ) return jQuery.offset.bodyOffset( elem ); |
if ( !elem || !elem.ownerDocument ) { return null; } |
if ( elem === elem.ownerDocument.body ) { |
return jQuery.offset.bodyOffset( elem ); |
} |
|
jQuery.offset.initialize(); |
|
var offsetParent = elem.offsetParent, prevOffsetParent = elem, |
4488,32 → 4739,45 |
top = elem.offsetTop, left = elem.offsetLeft; |
|
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) { |
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) break; |
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { break; } |
|
computedStyle = defaultView.getComputedStyle(elem, null); |
top -= elem.scrollTop, left -= elem.scrollLeft; |
top -= elem.scrollTop; |
left -= elem.scrollLeft; |
|
if ( elem === offsetParent ) { |
top += elem.offsetTop, left += elem.offsetLeft; |
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.tagName)) ) |
top += parseFloat( computedStyle.borderTopWidth ) || 0, |
top += elem.offsetTop; |
left += elem.offsetLeft; |
|
if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(elem.nodeName)) ) { |
top += parseFloat( computedStyle.borderTopWidth ) || 0; |
left += parseFloat( computedStyle.borderLeftWidth ) || 0; |
} |
|
prevOffsetParent = offsetParent, offsetParent = elem.offsetParent; |
} |
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) |
top += parseFloat( computedStyle.borderTopWidth ) || 0, |
|
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) { |
top += parseFloat( computedStyle.borderTopWidth ) || 0; |
left += parseFloat( computedStyle.borderLeftWidth ) || 0; |
} |
|
prevComputedStyle = computedStyle; |
} |
|
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) |
top += body.offsetTop, |
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) { |
top += body.offsetTop; |
left += body.offsetLeft; |
} |
|
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) |
top += Math.max( docElem.scrollTop, body.scrollTop ), |
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) { |
top += Math.max( docElem.scrollTop, body.scrollTop ); |
left += Math.max( docElem.scrollLeft, body.scrollLeft ); |
} |
|
return { top: top, left: left }; |
}; |
} |
|
jQuery.offset = { |
initialize: function() { |
4524,14 → 4788,17 |
|
container.innerHTML = html; |
body.insertBefore( container, body.firstChild ); |
innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td = innerDiv.nextSibling.firstChild.firstChild; |
innerDiv = container.firstChild; |
checkDiv = innerDiv.firstChild; |
td = innerDiv.nextSibling.firstChild.firstChild; |
|
this.doesNotAddBorder = (checkDiv.offsetTop !== 5); |
this.doesAddBorderForTableAndCells = (td.offsetTop === 5); |
|
checkDiv.style.position = 'fixed', checkDiv.style.top = '20px'; |
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15); // safari subtracts parent border width here which is 5px |
checkDiv.style.position = '', checkDiv.style.top = ''; |
// safari subtracts parent border width here which is 5px |
this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15); |
checkDiv.style.position = checkDiv.style.top = ''; |
|
innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative'; |
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); |
4539,17 → 4806,20 |
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); |
|
body.removeChild( container ); |
body = container = innerDiv = checkDiv = table = td = null; |
jQuery.offset.initialize = function(){}; |
|
body = container = innerDiv = checkDiv = table = td = null; |
}, |
|
bodyOffset: function(body) { |
var top = body.offsetTop, left = body.offsetLeft; |
|
jQuery.offset.initialize(); |
var top = body.offsetTop, left = body.offsetLeft; |
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) |
top += parseFloat( jQuery.curCSS(body, 'marginTop', true) ) || 0, |
|
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) { |
top += parseFloat( jQuery.curCSS(body, 'marginTop', true) ) || 0; |
left += parseFloat( jQuery.curCSS(body, 'marginLeft', true) ) || 0; |
} |
|
return { top: top, left: left }; |
} |
}; |
4557,7 → 4827,7 |
|
jQuery.fn.extend({ |
position: function() { |
if ( !this[0] ) return null; |
if ( !this[0] ) { return null; } |
|
var elem = this[0], |
|
4566,7 → 4836,7 |
|
// Get correct offsets |
offset = this.offset(), |
parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset(); |
parentOffset = /^body|html$/i.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); |
|
// Subtract element margins |
// note: when an element has margin: auto the offsetLeft and marginLeft |
4586,10 → 4856,13 |
}, |
|
offsetParent: function() { |
var offsetParent = this[0].offsetParent || document.body; |
while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') === 'static') ) |
offsetParent = offsetParent.offsetParent; |
return jQuery( offsetParent ); |
return this.map(function(){ |
var offsetParent = this.offsetParent || document.body; |
while ( offsetParent && (!/^body|html$/i.test(offsetParent.nodeName) && jQuery.css(offsetParent, 'position') === 'static') ) { |
offsetParent = offsetParent.offsetParent; |
} |
return offsetParent; |
}); |
} |
}); |
|
4599,20 → 4872,15 |
var method = 'scroll' + name; |
|
jQuery.fn[ method ] = function(val) { |
if ( !this[0] ) return null; |
var elem = this[0], win; |
|
var elem = this[0], win = ("scrollTo" in elem && elem.document) ? elem : |
(elem.nodeName === "#document") ? elem.defaultView || elem.parentWindow : |
false; |
if ( !elem ) { return null; } |
|
return val !== undefined ? |
if ( val !== undefined ) { |
// Set the scroll offset |
return this.each(function() { |
win = getWindow( this ); |
|
// Set the scroll offset |
this.each(function() { |
win = ("scrollTo" in this && this.document) ? this : |
(this.nodeName === "#document") ? this.defaultView || this.parentWindow : |
false; |
|
win ? |
win.scrollTo( |
!i ? val : jQuery(win).scrollLeft(), |
4619,16 → 4887,26 |
i ? val : jQuery(win).scrollTop() |
) : |
this[ method ] = val; |
}) : |
}); |
} else { |
win = getWindow( elem ); |
|
// Return the scroll offset |
win ? |
win[ i ? 'pageYOffset' : 'pageXOffset' ] || |
jQuery.support.boxModel && win.document.documentElement[ method ] || |
return win ? ('pageXOffset' in win) ? win[ i ? 'pageYOffset' : 'pageXOffset' ] : |
jQuery.support.boxModel && win.document.documentElement[ method ] || |
win.document.body[ method ] : |
elem[ method ]; |
} |
}; |
}); |
|
function getWindow( elem ) { |
return ("scrollTo" in elem && elem.document) ? |
elem : |
elem.nodeType === 9 ? |
elem.defaultView || elem.parentWindow : |
false; |
} |
// Create innerHeight, innerWidth, outerHeight and outerWidth methods |
jQuery.each([ "Height", "Width" ], function(i, name){ |
|
4658,7 → 4936,7 |
elem.document.body[ "client" + name ] : |
|
// Get document width or height |
(elem.nodeName === "#document") ? // is it a document |
(elem.nodeType === 9) ? // is it a document |
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater |
Math.max( |
elem.documentElement["client" + name], |