// Map over jQuery in case of overwrite
var _jQuery = window.jQuery,
// Map over jQuery in case of overwrite
var _jQuery = window.jQuery,
// Is it a simple selector
isSimple = /^.[^:#\[\.]*$/,
// Is it a simple selector
isSimple = /^.[^:#\[\.]*$/,
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) )
return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) )
return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Force the current matched set of elements to become
// the specified array of elements (destroying the stack in the process)
// You should use pushStack() in order to do this, but maintain the stack
// Force the current matched set of elements to become
// the specified array of elements (destroying the stack in the process)
// You should use pushStack() in order to do this, but maintain the stack
// is a super-fast way to populate an object with array-like properties
this.length = 0;
Array.prototype.push.apply( this, elems );
// is a super-fast way to populate an object with array-like properties
this.length = 0;
Array.prototype.push.apply( this, elems );
// the matched set of elements
index: function( elem ) {
var ret = -1;
// Locate the position of the desired element
// the matched set of elements
index: function( elem ) {
var ret = -1;
// Locate the position of the desired element
// If it receives a jQuery object, the first element is used
elem && elem.jquery ? elem[0] : elem
, this );
// If it receives a jQuery object, the first element is used
elem && elem.jquery ? elem[0] : elem
, this );
// Look for the case where we're accessing a style value
if ( name.constructor == String )
if ( value === undefined )
// Look for the case where we're accessing a style value
if ( name.constructor == String )
if ( value === undefined )
before: function() {
return this.domManip(arguments, false, false, function(elem){
this.parentNode.insertBefore( elem, this );
before: function() {
return this.domManip(arguments, false, false, function(elem){
this.parentNode.insertBefore( elem, this );
// using cloneNode. Calling detachEvent on the
// clone will also remove the events from the orignal
// In order to get around this, we use innerHTML.
// using cloneNode. Calling detachEvent on the
// clone will also remove the events from the orignal
// In order to get around this, we use innerHTML.
- // Unfortunately, this means some modifications to
- // attributes in IE that are actually only stored
+ // Unfortunately, this means some modifications to
+ // attributes in IE that are actually only stored
// as properties will not be copied (such as the
// the name attribute on an input).
var clone = this.cloneNode(true),
// as properties will not be copied (such as the
// the name attribute on an input).
var clone = this.cloneNode(true),
if ( option.selected ) {
// Get the specifc value for the option
value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
if ( option.selected ) {
// Get the specifc value for the option
value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
// Everything else, we just grab the value
} else
return (this[0].value || "").replace(/\r/g, "");
// Everything else, we just grab the value
} else
return (this[0].value || "").replace(/\r/g, "");
if ( value === undefined ) {
var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
if ( value === undefined ) {
var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
if ( data === undefined && this.length )
data = jQuery.data( this[0], key );
if ( data === undefined && this.length )
data = jQuery.data( this[0], key );
domManip: function( args, table, reverse, callback ) {
domManip: function( args, table, reverse, callback ) {
if ( (options = arguments[ i ]) != null )
// Extend the base object
for ( var name in options ) {
if ( (options = arguments[ i ]) != null )
// Extend the base object
for ( var name in options ) {
// check if an element is in a (or is an) XML document
isXMLDoc: function( elem ) {
return elem.documentElement && !elem.body ||
// check if an element is in a (or is an) XML document
isXMLDoc: function( elem ) {
return elem.documentElement && !elem.body ||
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
},
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 ] = {};
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 ] = {};
// Prevent overriding the named cache with undefined values
if ( data !== undefined )
jQuery.cache[ id ][ name ] = data;
// Prevent overriding the named cache with undefined values
if ( data !== undefined )
jQuery.cache[ id ][ name ] = data;
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0, length = object.length;
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0, length = object.length;
prop: function( elem, value, type, i, name ) {
// Handle executable functions
if ( jQuery.isFunction( value ) )
value = value.call( elem, i );
prop: function( elem, value, type, i, name ) {
// Handle executable functions
if ( jQuery.isFunction( value ) )
value = value.call( elem, i );
// Handle passing in a number to a CSS property
return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
value + "px" :
// Handle passing in a number to a CSS property
return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
value + "px" :
if (elem.nodeType == 1)
elem.className = classNames != undefined ?
jQuery.grep(elem.className.split(/\s+/), function(className){
if (elem.nodeType == 1)
elem.className = classNames != undefined ?
jQuery.grep(elem.className.split(/\s+/), function(className){
css: function( elem, name, force ) {
if ( name == "width" || name == "height" ) {
var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
css: function( elem, name, force ) {
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;
var padding = 0, border = 0;
function getWH() {
val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
var padding = 0, border = 0;
if ( jQuery(elem).is(":visible") )
getWH();
else
jQuery.swap( elem, props, getWH );
if ( jQuery(elem).is(":visible") )
getWH();
else
jQuery.swap( elem, props, getWH );
// getComputedStyle is cached
var ret = getComputedStyle( elem, null );
return !ret || ret.getPropertyValue("color") == "";
// getComputedStyle is cached
var ret = getComputedStyle( elem, null );
return !ret || ret.getPropertyValue("color") == "";
clean: function( elems, context ) {
var ret = [];
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
clean: function( elems, context ) {
var ret = [];
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
jQuery.each(elems, function(i, elem){
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
jQuery.each(elems, function(i, elem){
// Convert html string into DOM nodes
if ( typeof elem == "string" ) {
// Fix "XHTML"-style tags in all browsers
// Convert html string into DOM nodes
if ( typeof elem == "string" ) {
// Fix "XHTML"-style tags in all browsers
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
[ 1, "<table>", "</table>" ] ||
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
[ 1, "<table>", "</table>" ] ||
// <thead> matched above
(!tags.indexOf("<td") || !tags.indexOf("<th")) &&
[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
// <thead> matched above
(!tags.indexOf("<td") || !tags.indexOf("<th")) &&
[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
!tags.indexOf("<col") &&
[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
// IE can't serialize <link> and <script> tags normally
jQuery.browser.msie &&
[ 1, "div<div>", "</div>" ] ||
!tags.indexOf("<col") &&
[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
// IE can't serialize <link> and <script> tags normally
jQuery.browser.msie &&
[ 1, "div<div>", "</div>" ] ||
[ 0, "", "" ];
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
[ 0, "", "" ];
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
// String was a <table>, *may* have spurious <tbody>
var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
div.firstChild && div.firstChild.childNodes :
// String was a <table>, *may* have spurious <tbody>
var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
div.firstChild && div.firstChild.childNodes :
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 ] );
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 ] );
// convert the value to a string (all browsers do this but IE) see #1070
elem.setAttribute( name, "" + value );
// convert the value to a string (all browsers do this but IE) see #1070
elem.setAttribute( name, "" + value );
return elem.getAttribute( name, 2 );
return elem.getAttribute( name );
return elem.getAttribute( name, 2 );
return elem.getAttribute( name );
// Set the alpha filter to set the opacity
elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
// Set the alpha filter to set the opacity
elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
merge: function( first, second ) {
// We have to loop this way because IE & Opera overwrite the length
// expando of getElementsByTagName
merge: function( first, second ) {
// We have to loop this way because IE & Opera overwrite the length
// expando of getElementsByTagName
// Also, we need to make sure that the correct elements are being returned
// (IE returns comment nodes in a '*' query)
if ( jQuery.browser.msie ) {
// Also, we need to make sure that the correct elements are being returned
// (IE returns comment nodes in a '*' query)
if ( jQuery.browser.msie ) {
- for ( ; second[ i ]; i++ )
- if ( second[ i ].nodeType != 8 )
- first.push( second[ i ] );
+ while ( elem = second[ i++ ] )
+ if ( elem.nodeType != 8 )
+ first[ pos++ ] = elem;
jQuery.extend({
// Check to see if the W3C box model is being used
boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
jQuery.extend({
// Check to see if the W3C box model is being used
boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
jQuery.each({
removeAttr: function( name ) {
jQuery.attr( this, name, "" );
jQuery.each({
removeAttr: function( name ) {
jQuery.attr( this, name, "" );
empty: function() {
// Remove element nodes and prevent memory leaks
jQuery( ">*", this ).remove();
empty: function() {
// Remove element nodes and prevent memory leaks
jQuery( ">*", this ).remove();
// Remove any remaining nodes
while ( this.firstChild )
this.removeChild( this.firstChild );
// Remove any remaining nodes
while ( this.firstChild )
this.removeChild( this.firstChild );
jQuery.each([ "Height", "Width" ], function(i, name){
var type = name.toLowerCase();
jQuery.each([ "Height", "Width" ], function(i, name){
var type = name.toLowerCase();
jQuery.fn[ type ] = function( size ) {
// Get window width or height
return this[0] == window ?
// Opera reports document.body.client[Width/Height] properly in both quirks and standards
jQuery.fn[ type ] = function( size ) {
// Get window width or height
return this[0] == window ?
// Opera reports document.body.client[Width/Height] properly in both quirks and standards
// Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
jQuery.browser.safari && window[ "inner" + name ] ||
// Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
jQuery.browser.safari && window[ "inner" + name ] ||
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :
// Get document width or height
this[0] == document ?
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
// Get document width or height
this[0] == document ?
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
- Math.max(
- Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
- Math.max(document.body["offset" + name], document.documentElement["offset" + name])
+ Math.max(
+ Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]),
+ Math.max(document.body["offset" + name], document.documentElement["offset" + name])