Хранилища Subversion ant

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

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

/trunk/js/jquery.js
1,5 → 1,5
/*!
* jQuery JavaScript Library v1.3.2
* jQuery JavaScript Library v1.3.3pre
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
6,12 → 6,12
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
* Revision: 6246
* Date: 2009-03-28 00:20:57 +0600 (Сбт, 28 Мар 2009)
* Revision: 6301
*/
(function(){
 
var
var
// Will speed up references to window, and allows munging its name.
window = this,
// Will speed up references to undefined, and allows munging its name.
23,7 → 23,9
 
jQuery = window.jQuery = window.$ = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context );
return selector === undefined ?
rootjQuery :
new jQuery.fn.init( selector, context );
},
 
// A simple way to check for HTML strings or ID strings
34,8 → 36,11
 
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
// Make sure that a selection was provided
selector = selector || document;
// Handle $("") or $(null)
if ( !selector ) {
this.length = 0;
return this;
}
 
// Handle $(DOMElement)
if ( selector.nodeType ) {
44,6 → 49,7
this.context = selector;
return this;
}
 
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
53,34 → 59,41
if ( match && (match[1] || !context) ) {
 
// HANDLE: $(html) -> $(array)
if ( match[1] )
if ( match[1] ) {
selector = jQuery.clean( [ match[1] ], context );
 
// HANDLE: $("#id")
else {
} else {
var elem = document.getElementById( match[3] );
 
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem && elem.id != match[3] )
return jQuery().find( selector );
if ( elem && elem.id != match[3] ) {
return rootjQuery.find( selector );
}
 
// Otherwise, we inject the element directly into the jQuery object
var ret = jQuery( elem || [] );
var ret = jQuery( elem || null );
ret.context = document;
ret.selector = selector;
return ret;
}
 
// HANDLE: $(expr, [context])
// (which is just equivalent to: $(content).find(expr)
} else
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return (context || rootjQuery).find( selector );
 
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return jQuery( context ).find( selector );
}
 
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) )
return jQuery( document ).ready( selector );
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
 
// Make sure that old selector state is passed along
if ( selector.selector && selector.context ) {
97,7 → 110,7
selector: "",
 
// The current version of jQuery being used
jquery: "1.3.2",
jquery: "1.3.3pre",
 
// The number of elements contained in the matched element set
size: function() {
120,7 → 133,7
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = jQuery( elems );
var ret = jQuery( elems || null );
 
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
165,376 → 178,15
, this );
},
 
attr: function( name, value, type ) {
var options = name;
 
// Look for the case where we're accessing a style value
if ( typeof name === "string" )
if ( value === undefined )
return this[0] && jQuery[ type || "attr" ]( this[0], name );
 
else {
options = {};
options[ name ] = value;
}
 
// Check to see if we're setting style values
return this.each(function(i){
// Set all the styles
for ( name in options )
jQuery.attr(
type ?
this.style :
this,
name, jQuery.prop( this, options[ name ], type, i, name )
);
});
is: function( selector ) {
return !!selector && jQuery.multiFilter( selector, this ).length > 0;
},
 
css: function( key, value ) {
// ignore negative width and height values
if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
value = undefined;
return this.attr( key, value, "curCSS" );
},
 
text: function( text ) {
if ( typeof text !== "object" && text != null )
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
 
var ret = "";
 
jQuery.each( text || this, function(){
jQuery.each( this.childNodes, function(){
if ( this.nodeType != 8 )
ret += this.nodeType != 1 ?
this.nodeValue :
jQuery.fn.text( [ this ] );
});
});
 
return ret;
},
 
wrapAll: function( html ) {
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).clone();
 
if ( this[0].parentNode )
wrap.insertBefore( this[0] );
 
wrap.map(function(){
var elem = this;
 
while ( elem.firstChild )
elem = elem.firstChild;
 
return elem;
}).append(this);
}
 
return this;
},
 
wrapInner: function( html ) {
return this.each(function(){
jQuery( this ).contents().wrapAll( html );
});
},
 
wrap: function( html ) {
return this.each(function(){
jQuery( this ).wrapAll( html );
});
},
 
append: function() {
return this.domManip(arguments, true, function(elem){
if (this.nodeType == 1)
this.appendChild( elem );
});
},
 
prepend: function() {
return this.domManip(arguments, true, function(elem){
if (this.nodeType == 1)
this.insertBefore( elem, this.firstChild );
});
},
 
before: function() {
return this.domManip(arguments, false, function(elem){
this.parentNode.insertBefore( elem, this );
});
},
 
after: function() {
return this.domManip(arguments, false, function(elem){
this.parentNode.insertBefore( elem, this.nextSibling );
});
},
 
end: function() {
return this.prevObject || jQuery( [] );
},
 
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: [].push,
sort: [].sort,
splice: [].splice,
 
find: function( selector ) {
if ( this.length === 1 ) {
var ret = this.pushStack( [], "find", selector );
ret.length = 0;
jQuery.find( selector, this[0], ret );
return ret;
} else {
return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){
return jQuery.find( selector, elem );
})), "find", selector );
}
},
 
clone: function( events ) {
// Do the clone
var ret = this.map(function(){
if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
// IE copies events bound via attachEvent when
// 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
// as properties will not be copied (such as the
// the name attribute on an input).
var html = this.outerHTML;
if ( !html ) {
var div = this.ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
}
 
return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0];
} else
return this.cloneNode(true);
});
 
// Copy the events from the original to the clone
if ( events === true ) {
var orig = this.find("*").andSelf(), i = 0;
 
ret.find("*").andSelf().each(function(){
if ( this.nodeName !== orig[i].nodeName )
return;
 
var events = jQuery.data( orig[i], "events" );
 
for ( var type in events ) {
for ( var handler in events[ type ] ) {
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
}
}
 
i++;
});
}
 
// Return the cloned set
return ret;
},
 
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 );
},
 
closest: function( selector ) {
var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
closer = 0;
 
return this.map(function(){
var cur = this;
while ( cur && cur.ownerDocument ) {
if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
jQuery.data(cur, "closest", closer);
return cur;
}
cur = cur.parentNode;
closer++;
}
});
},
 
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(),
typeof selector === "string" ?
jQuery( selector ) :
jQuery.makeArray( selector )
)));
},
 
is: function( selector ) {
return !!selector && jQuery.multiFilter( selector, this ).length > 0;
},
 
hasClass: function( selector ) {
return !!selector && this.is( "." + selector );
},
 
val: function( value ) {
if ( value === undefined ) {
var elem = this[0];
 
if ( elem ) {
if( jQuery.nodeName( elem, 'option' ) )
return (elem.attributes.value || {}).specified ? elem.value : elem.text;
// We need to handle select boxes special
if ( jQuery.nodeName( elem, "select" ) ) {
var index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type == "select-one";
 
// Nothing was selected
if ( index < 0 )
return null;
 
// Loop through all the selected options
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
var option = options[ i ];
 
if ( option.selected ) {
// Get the specifc value for the option
value = jQuery(option).val();
 
// We don't need an array for one selects
if ( one )
return value;
 
// Multi-Selects return an array
values.push( value );
}
}
 
return values;
}
 
// Everything else, we just grab the value
return (elem.value || "").replace(/\r/g, "");
 
}
 
return undefined;
}
 
if ( typeof value === "number" )
value += '';
 
return this.each(function(){
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);
 
else if ( jQuery.nodeName( this, "select" ) ) {
var values = jQuery.makeArray(value);
 
jQuery( "option", this ).each(function(){
this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
jQuery.inArray( this.text, values ) >= 0);
});
 
if ( !values.length )
this.selectedIndex = -1;
 
} else
this.value = value;
});
},
 
html: function( value ) {
return value === undefined ?
(this[0] ?
this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
null) :
this.empty().append( value );
},
 
replaceWith: function( value ) {
return this.after( value ).remove();
},
 
eq: function( i ) {
return this.slice( i, +i + 1 );
},
 
slice: function() {
return this.pushStack( Array.prototype.slice.apply( this, arguments ),
"slice", Array.prototype.slice.call(arguments).join(",") );
},
 
map: function( callback ) {
return this.pushStack( jQuery.map(this, function(elem, i){
return callback.call( elem, i, elem );
}));
},
 
andSelf: function() {
return this.add( this.prevObject );
},
 
domManip: function( 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 ( 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 ( scripts )
jQuery.each( scripts, evalScript );
}
 
return this;
function root( elem, cur ) {
return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
}
splice: [].splice
};
 
// Give the init function the jQuery prototype for later instantiation
594,7 → 246,7
 
// Recurse if we're merging object values
if ( deep && copy && typeof copy === "object" && !copy.nodeType )
target[ name ] = jQuery.extend( deep,
target[ name ] = jQuery.extend( deep,
// Never move original objects, clone them
src || ( copy.length != null ? [ ] : { } )
, copy );
609,11 → 261,7
return target;
};
 
// exclude the following css properties to add px
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
// cache defaultView
defaultView = document.defaultView || {},
toString = Object.prototype.toString;
var toString = Object.prototype.toString;
 
jQuery.extend({
noConflict: function( deep ) {
639,7 → 287,7
// 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 && jQuery.isXMLDoc( elem.ownerDocument );
!!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML";
},
 
// Evalulates a script in a global context
695,374 → 343,6
return object;
},
 
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 typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
value + "px" :
value;
},
 
className: {
// internal only, use addClass("class")
add: function( elem, classNames ) {
jQuery.each((classNames || "").split(/\s+/), function(i, className){
if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
elem.className += (elem.className ? " " : "") + className;
});
},
 
// internal only, use removeClass("class")
remove: function( elem, classNames ) {
if (elem.nodeType == 1)
elem.className = classNames !== undefined ?
jQuery.grep(elem.className.split(/\s+/), function(className){
return !jQuery.className.has( classNames, className );
}).join(" ") :
"";
},
 
// internal only, use hasClass("class")
has: function( elem, className ) {
return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
}
},
 
// 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 ];
elem.style[ name ] = options[ name ];
}
 
callback.call( elem );
 
// Revert the old values
for ( var name in options )
elem.style[ name ] = old[ 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" ];
 
function getWH() {
val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
 
if ( extra === "border" )
return;
 
jQuery.each( which, function() {
if ( !extra )
val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
if ( extra === "margin" )
val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
else
val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
});
}
 
if ( elem.offsetWidth !== 0 )
getWH();
else
jQuery.swap( elem, props, getWH );
 
return Math.max(0, Math.round(val));
}
 
return jQuery.curCSS( elem, name, force );
},
 
curCSS: function( elem, name, force ) {
var ret, style = elem.style;
 
// We need to handle opacity special in IE
if ( name == "opacity" && !jQuery.support.opacity ) {
ret = jQuery.attr( style, "opacity" );
 
return ret == "" ?
"1" :
ret;
}
 
// Make sure we're using the right name for getting the float value
if ( name.match( /float/i ) )
name = styleFloat;
 
if ( !force && style && style[ name ] )
ret = style[ name ];
 
else if ( defaultView.getComputedStyle ) {
 
// Only "float" is needed here
if ( name.match( /float/i ) )
name = "float";
 
name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
 
var computedStyle = defaultView.getComputedStyle( elem, null );
 
if ( computedStyle )
ret = computedStyle.getPropertyValue( name );
 
// We should always get a number back from opacity
if ( name == "opacity" && ret == "" )
ret = "1";
 
} else if ( elem.currentStyle ) {
var camelCase = name.replace(/\-(\w)/g, function(all, letter){
return letter.toUpperCase();
});
 
ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
 
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
 
// 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 ) ) {
// Remember the original values
var left = style.left, rsLeft = elem.runtimeStyle.left;
 
// Put in the new values to get a computed value out
elem.runtimeStyle.left = elem.currentStyle.left;
style.left = ret || 0;
ret = style.pixelLeft + "px";
 
// Revert the changed values
style.left = left;
elem.runtimeStyle.left = rsLeft;
}
}
 
return ret;
},
 
clean: function( elems, context, fragment ) {
context = context || document;
 
// !context.createElement fails in IE with an error but returns typeof 'object'
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 )
return [ context.createElement( match[1] ) ];
}
 
var ret = [], scripts = [], div = context.createElement("div");
 
jQuery.each(elems, function(i, elem){
if ( typeof elem === "number" )
elem += '';
 
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 + ">";
});
 
// Trim whitespace, otherwise indexOf won't work as expected
var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
 
var wrap =
// option or optgroup
!tags.indexOf("<opt") &&
[ 1, "<select multiple='multiple'>", "</select>" ] ||
 
!tags.indexOf("<leg") &&
[ 1, "<fieldset>", "</fieldset>" ] ||
 
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
[ 1, "<table>", "</table>" ] ||
 
!tags.indexOf("<tr") &&
[ 2, "<table><tbody>", "</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.support.htmlSerialize &&
[ 1, "div<div>", "</div>" ] ||
 
[ 0, "", "" ];
 
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
 
// Move to the right depth
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),
tbody = !tags.indexOf("<table") && !hasBody ?
div.firstChild && div.firstChild.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 )
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 );
elem = jQuery.makeArray( div.childNodes );
}
 
if ( elem.nodeType )
ret.push( elem );
else
ret = jQuery.merge( ret, elem );
 
});
 
if ( fragment ) {
for ( var i = 0; ret[i]; i++ ) {
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 )
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
fragment.appendChild( ret[i] );
}
}
return scripts;
}
 
return ret;
},
 
attr: function( elem, name, value ) {
// don't set attributes on text and comment nodes
if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
return undefined;
 
var notxml = !jQuery.isXMLDoc( elem ),
// Whether we are setting (or getting)
set = value !== undefined;
 
// Try to normalize/fix the name
name = notxml && jQuery.props[ name ] || name;
 
// Only do all the following if this is a node (faster for style)
// IE elem.getAttribute passes even for style
if ( elem.tagName ) {
 
// These attributes require special treatment
var special = /href|src|style/.test( name );
 
// Safari mis-reports the default selected property of a hidden option
// Accessing the parent's selectedIndex property fixes it
if ( name == "selected" && elem.parentNode )
elem.parentNode.selectedIndex;
 
// If applicable, access the attribute via the DOM 0 way
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" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
throw "type property can't be changed";
 
elem[ name ] = value;
}
 
// browsers index elements by id/name on forms, give priority to attributes.
if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
return elem.getAttributeNode( name ).nodeValue;
 
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
if ( name == "tabIndex" ) {
var attributeNode = elem.getAttributeNode( "tabIndex" );
return attributeNode && attributeNode.specified
? attributeNode.value
: elem.nodeName.match(/(button|input|object|select|textarea)/i)
? 0
: elem.nodeName.match(/^(a|area)$/i) && elem.href
? 0
: undefined;
}
 
return elem[ name ];
}
 
if ( !jQuery.support.style && notxml && name == "style" )
return jQuery.attr( elem.style, "cssText", value );
 
if ( set )
// convert the value to a string (all browsers do this but IE) see #1070
elem.setAttribute( name, "" + value );
 
var attr = !jQuery.support.hrefNormalized && notxml && special
// Some attributes require a special call on IE
? elem.getAttribute( name, 2 )
: elem.getAttribute( name );
 
// Non-existent attributes return null, we normalize to undefined
return attr === null ? undefined : attr;
}
 
// elem is actually elem.style ... set the style
 
// IE uses filters for 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
elem.zoom = 1;
 
// Set the alpha filter to set the opacity
elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
}
 
return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
"";
}
 
name = name.replace(/-([a-z])/ig, function(all, letter){
return letter.toUpperCase();
});
 
if ( set )
elem[ name ] = value;
 
return elem[ name ];
},
 
trim: function( text ) {
return (text || "").replace( /^\s+|\s+$/g, "" );
},
1159,6 → 439,9
}
});
 
// All jQuery objects should point back to these
var rootjQuery = jQuery(document);
 
// Use of jQuery.browser is deprecated.
// It's included for backwards compatibility and plugins,
// although they should work to migrate away.
1172,101 → 455,7
opera: /opera/.test( userAgent ),
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};
 
jQuery.each({
parent: function(elem){return elem.parentNode;},
parents: function(elem){return jQuery.dir(elem,"parentNode");},
next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
children: function(elem){return jQuery.sibling(elem.firstChild);},
contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
}, function(name, fn){
jQuery.fn[ name ] = function( selector ) {
var ret = jQuery.map( this, fn );
 
if ( selector && typeof selector == "string" )
ret = jQuery.multiFilter( selector, ret );
 
return this.pushStack( jQuery.unique( ret ), name, selector );
};
});
 
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function(name, original){
jQuery.fn[ name ] = function( selector ) {
var ret = [], insert = jQuery( selector );
 
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = (i > 0 ? this.clone(true) : this).get();
jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
ret = ret.concat( elems );
}
 
return this.pushStack( ret, name, selector );
};
});
 
jQuery.each({
removeAttr: function( name ) {
jQuery.attr( this, name, "" );
if (this.nodeType == 1)
this.removeAttribute( name );
},
 
addClass: function( classNames ) {
jQuery.className.add( this, classNames );
},
 
removeClass: function( classNames ) {
jQuery.className.remove( this, classNames );
},
 
toggleClass: function( classNames, state ) {
if( typeof state !== "boolean" )
state = !jQuery.className.has( this, classNames );
jQuery.className[ state ? "add" : "remove" ]( this, classNames );
},
 
remove: function( selector ) {
if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
// Prevent memory leaks
jQuery( "*", this ).add([this]).each(function(){
jQuery.event.remove(this);
jQuery.removeData(this);
});
if (this.parentNode)
this.parentNode.removeChild( this );
}
},
 
empty: function() {
// Remove element nodes and prevent memory leaks
jQuery(this).children().remove();
 
// Remove any remaining nodes
while ( this.firstChild )
this.removeChild( this.firstChild );
}
}, function(name, fn){
jQuery.fn[ name ] = function(){
return this.each( fn, arguments );
};
});
 
// Helper function used by the dimensions and offset modules
function num(elem, prop) {
return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
}
var expando = "jQuery" + now(), uuid = 0, windowData = {};
};var expando = "jQuery" + now(), uuid = 0, windowData = {};
 
jQuery.extend({
cache: {},
1338,16 → 527,16
},
queue: function( elem, type, data ) {
if ( elem ){
 
type = (type || "fx") + "queue";
 
var q = jQuery.data( elem, type );
 
if ( !q || jQuery.isArray(data) )
q = jQuery.data( elem, type, jQuery.makeArray(data) );
else if( data )
q.push( data );
 
}
return q;
},
1355,10 → 544,10
dequeue: function( elem, type ){
var queue = jQuery.queue( elem, type ),
fn = queue.shift();
 
if( !type || type === "fx" )
fn = queue[0];
 
if( fn !== undefined )
fn.call(elem);
}
1400,7 → 589,7
 
return this.each(function(){
var queue = jQuery.queue( this, type, data );
 
if( type == "fx" && queue.length == 1 )
queue[0].call(this);
});
1411,7 → 600,7
});
}
});/*!
* Sizzle CSS Selector Engine - v0.9.3
* Sizzle CSS Selector Engine - v1.0
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
1424,23 → 613,24
 
var Sizzle = function(selector, context, results, seed) {
results = results || [];
context = context || document;
var origContext = context = context || document;
 
if ( context.nodeType !== 1 && context.nodeType !== 9 )
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
 
if ( !selector || typeof selector !== "string" ) {
return results;
}
 
var parts = [], m, set, checkSet, check, mode, extra, prune = true;
var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context);
 
// Reset the position of the chunker regexp (start from head)
chunker.lastIndex = 0;
 
while ( (m = chunker.exec(selector)) !== null ) {
parts.push( m[1] );
 
if ( m[2] ) {
extra = RegExp.rightContext;
break;
1465,31 → 655,43
}
}
} else {
var ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
set = Sizzle.filter( ret.expr, ret.set );
 
if ( parts.length > 0 ) {
checkSet = makeArray(set);
} else {
prune = false;
// Take a shortcut and set the context if the root selector is an ID
// (but not if it'll be faster if the inner selector is an ID)
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
var ret = Sizzle.find( parts.shift(), context, contextXML );
context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
}
 
while ( parts.length ) {
var cur = parts.pop(), pop = cur;
if ( context ) {
var ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
 
if ( !Expr.relative[ cur ] ) {
cur = "";
if ( parts.length > 0 ) {
checkSet = makeArray(set);
} else {
pop = parts.pop();
prune = false;
}
 
if ( pop == null ) {
pop = context;
while ( parts.length ) {
var cur = parts.pop(), pop = cur;
 
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
 
if ( pop == null ) {
pop = context;
}
 
Expr.relative[ cur ]( checkSet, pop, contextXML );
}
 
Expr.relative[ cur ]( checkSet, pop, isXML(context) );
} else {
checkSet = parts = [];
}
}
 
1504,7 → 706,7
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context.nodeType === 1 ) {
} else if ( context && context.nodeType === 1 ) {
for ( var i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
results.push( set[i] );
1522,23 → 724,26
}
 
if ( extra ) {
Sizzle( extra, context, results, seed );
Sizzle( extra, origContext, results, seed );
Sizzle.uniqueSort( results );
}
 
if ( sortOrder ) {
hasDuplicate = false;
results.sort(sortOrder);
return results;
};
 
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[i-1] ) {
results.splice(i--, 1);
}
Sizzle.uniqueSort = function(results){
if ( sortOrder ) {
hasDuplicate = false;
results.sort(sortOrder);
 
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[i-1] ) {
results.splice(i--, 1);
}
}
}
}
 
return results;
};
 
Sizzle.matches = function(expr, set){
1554,7 → 759,7
 
for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var type = Expr.order[i], match;
 
if ( (match = Expr.match[ type ].exec( expr )) ) {
var left = RegExp.leftContext;
 
1816,7 → 1021,7
},
ATTR: function(match, curLoop, inplace, result, not, isXML){
var name = match[1].replace(/\\/g, "");
 
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
1842,7 → 1047,7
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
 
return match;
},
POS: function(match){
1976,10 → 1181,10
if ( first == 1 && last == 0 ) {
return true;
}
 
var doneName = match[0],
parent = elem.parentNode;
 
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
1986,10 → 1191,10
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
}
parent.sizcache = doneName;
}
 
var diff = elem.nodeIndex - last;
if ( first == 0 ) {
return diff == 0;
2052,7 → 1257,7
var origPOS = Expr.match.POS;
 
for ( var type in Expr.match ) {
Expr.match[ type ] = RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
}
 
var makeArray = function(array, results) {
2062,7 → 1267,7
results.push.apply( results, array );
return results;
}
 
return array;
};
 
2131,9 → 1336,9
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
var form = document.createElement("form"),
var form = document.createElement("div"),
id = "script" + (new Date).getTime();
form.innerHTML = "<input name='" + id + "'/>";
form.innerHTML = "<a name='" + id + "'/>";
 
// Inject it into the root element, check its status, and remove it quickly
var root = document.documentElement;
2207,7 → 1412,7
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return;
}
 
Sizzle = function(query, context, extra, seed){
context = context || document;
 
2218,14 → 1423,13
return makeArray( context.querySelectorAll(query), extra );
} catch(e){}
}
 
return oldSizzle(query, context, extra, seed);
};
 
Sizzle.find = oldSizzle.find;
Sizzle.filter = oldSizzle.filter;
Sizzle.selectors = oldSizzle.selectors;
Sizzle.matches = oldSizzle.matches;
for ( var prop in oldSizzle ) {
Sizzle[ prop ] = oldSizzle[ prop ];
}
})();
 
if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
2337,7 → 1541,7
 
var isXML = function(elem){
return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
!!elem.ownerDocument && isXML( elem.ownerDocument );
!!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML";
};
 
var posProcess = function(selector, context){
2362,12 → 1566,11
 
// EXPOSE
jQuery.find = Sizzle;
jQuery.filter = Sizzle.filter;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
 
Sizzle.selectors.filters.hidden = function(elem){
return elem.offsetWidth === 0 || elem.offsetHeight === 0;
return elem.offsetWidth === 0 && elem.offsetHeight === 0;
};
 
Sizzle.selectors.filters.visible = function(elem){
2380,7 → 1583,7
}).length;
};
 
jQuery.multiFilter = function( expr, elems, not ) {
jQuery.filter = jQuery.multiFilter = function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
2425,6 → 1628,715
window.Sizzle = Sizzle;
 
})();
jQuery.fn.extend({
find: function( selector ) {
var ret = this.pushStack( "", "find", selector ), length = 0;
 
for ( var i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
 
if ( i > 0 ) {
// Make sure that the results are unique
for ( var n = length; n < ret.length; n++ ) {
for ( var r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
 
return ret;
},
 
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 );
},
 
closest: function( selector ) {
var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null,
closer = 0;
 
return this.map(function(){
var cur = this;
while ( cur && cur.ownerDocument ) {
if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
jQuery.data(cur, "closest", closer);
return cur;
}
cur = cur.parentNode;
closer++;
}
});
},
 
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(),
typeof selector === "string" ?
jQuery( selector ) :
jQuery.makeArray( selector )
)));
},
 
eq: function( i ) {
return this.slice( i, +i + 1 );
},
 
slice: function() {
return this.pushStack( Array.prototype.slice.apply( this, arguments ),
"slice", Array.prototype.slice.call(arguments).join(",") );
},
 
map: function( callback ) {
return this.pushStack( jQuery.map(this, function(elem, i){
return callback.call( elem, i, elem );
}));
},
 
andSelf: function() {
return this.add( this.prevObject );
},
 
end: function() {
return this.prevObject || jQuery(null);
}
});
 
jQuery.each({
parent: function(elem){return elem.parentNode;},
parents: function(elem){return jQuery.dir(elem,"parentNode");},
next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
children: function(elem){return jQuery.sibling(elem.firstChild);},
contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
}, function(name, fn){
jQuery.fn[ name ] = function( selector ) {
var ret = jQuery.map( this, fn );
 
if ( selector && typeof selector == "string" )
ret = jQuery.multiFilter( selector, ret );
 
return this.pushStack( jQuery.unique( ret ), name, selector );
};
});jQuery.fn.extend({
attr: function( name, value ) {
var options = name, isFunction = jQuery.isFunction( value );
 
if ( typeof name === "string" ) {
// Are we setting the attribute?
if ( value === undefined ) {
return this.length ?
jQuery.attr( this[0], name ) :
null;
 
// Convert name, value params to options hash format
} else {
options = {};
options[ 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 );
}
 
jQuery.attr( elem, prop, value );
}
}
 
return this;
},
 
hasClass: function( selector ) {
return !!selector && this.is( "." + selector );
},
 
val: function( value ) {
if ( value === undefined ) {
var elem = this[0];
 
if ( elem ) {
if( jQuery.nodeName( elem, 'option' ) )
return (elem.attributes.value || {}).specified ? elem.value : elem.text;
 
// We need to handle select boxes special
if ( jQuery.nodeName( elem, "select" ) ) {
var index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type == "select-one";
 
// Nothing was selected
if ( index < 0 )
return null;
 
// Loop through all the selected options
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
var option = options[ i ];
 
if ( option.selected ) {
// Get the specifc value for the option
value = jQuery(option).val();
 
// We don't need an array for one selects
if ( one )
return value;
 
// Multi-Selects return an array
values.push( value );
}
}
 
return values;
}
 
// Everything else, we just grab the value
return (elem.value || "").replace(/\r/g, "");
 
}
 
return undefined;
}
 
if ( typeof value === "number" )
value += '';
 
return this.each(function(){
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);
 
else if ( jQuery.nodeName( this, "select" ) ) {
var values = jQuery.makeArray(value);
 
jQuery( "option", this ).each(function(){
this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
jQuery.inArray( this.text, values ) >= 0);
});
 
if ( !values.length )
this.selectedIndex = -1;
 
} else
this.value = value;
});
}
});
 
jQuery.each({
removeAttr: function( name ) {
jQuery.attr( this, name, "" );
if (this.nodeType == 1)
this.removeAttribute( name );
},
 
addClass: function( classNames ) {
jQuery.className.add( this, classNames );
},
 
removeClass: function( classNames ) {
jQuery.className.remove( this, classNames );
},
 
toggleClass: function( classNames, state ) {
if( typeof state !== "boolean" )
state = !jQuery.className.has( this, classNames );
jQuery.className[ state ? "add" : "remove" ]( this, classNames );
}
}, function(name, fn){
jQuery.fn[ name ] = function(){
return this.each( fn, arguments );
};
});
 
jQuery.extend({
className: {
// internal only, use addClass("class")
add: function( elem, classNames ) {
jQuery.each((classNames || "").split(/\s+/), function(i, className){
if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
elem.className += (elem.className ? " " : "") + className;
});
},
 
// internal only, use removeClass("class")
remove: function( elem, classNames ) {
if (elem.nodeType == 1)
elem.className = classNames !== undefined ?
jQuery.grep(elem.className.split(/\s+/), function(className){
return !jQuery.className.has( classNames, className );
}).join(" ") :
"";
},
 
// internal only, use hasClass("class")
has: function( elem, className ) {
return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
}
},
 
attr: function( elem, name, value ) {
// don't set attributes on text and comment nodes
if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
return undefined;
 
var notxml = !elem.tagName || !jQuery.isXMLDoc( elem ),
// Whether we are setting (or getting)
set = value !== undefined;
 
// Try to normalize/fix the name
name = notxml && jQuery.props[ name ] || name;
 
// Only do all the following if this is a node (faster for style)
if ( elem.tagName ) {
 
// These attributes require special treatment
var special = /href|src|style/.test( name );
 
// Safari mis-reports the default selected property of a hidden option
// Accessing the parent's selectedIndex property fixes it
if ( name == "selected" && elem.parentNode )
elem.parentNode.selectedIndex;
 
// If applicable, access the attribute via the DOM 0 way
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 )
throw "type property can't be changed";
 
elem[ name ] = value;
}
 
// browsers index elements by id/name on forms, give priority to attributes.
if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
return elem.getAttributeNode( name ).nodeValue;
 
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
if ( name == "tabIndex" ) {
var attributeNode = elem.getAttributeNode( "tabIndex" );
return attributeNode && attributeNode.specified
? attributeNode.value
: elem.nodeName.match(/(button|input|object|select|textarea)/i)
? 0
: elem.nodeName.match(/^(a|area)$/i) && elem.href
? 0
: undefined;
}
 
return elem[ name ];
}
 
if ( !jQuery.support.style && notxml && name == "style" ) {
if ( set )
elem.style.cssText = "" + value;
 
return elem.style.cssText;
}
 
if ( set )
// convert the value to a string (all browsers do this but IE) see #1070
elem.setAttribute( name, "" + value );
 
var attr = !jQuery.support.hrefNormalized && notxml && special
// Some attributes require a special call on IE
? elem.getAttribute( name, 2 )
: elem.getAttribute( name );
 
// Non-existent attributes return null, we normalize to undefined
return attr === null ? undefined : attr;
}
 
// elem is actually elem.style ... set the style
// Using attr for specific style information is now deprecated. Use style insead.
return jQuery.style(elem, name, value);
}
});jQuery.fn.extend({
text: function( text ) {
if ( typeof text !== "object" && text != null )
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
 
var ret = "";
 
jQuery.each( text || this, function(){
jQuery.each( this.childNodes, function(){
if ( this.nodeType != 8 )
ret += this.nodeType != 1 ?
this.nodeValue :
jQuery.fn.text( [ this ] );
});
});
 
return ret;
},
 
wrapAll: function( html ) {
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).clone();
 
if ( this[0].parentNode )
wrap.insertBefore( this[0] );
 
wrap.map(function(){
var elem = this;
 
while ( elem.firstChild )
elem = elem.firstChild;
 
return elem;
}).append(this);
}
 
return this;
},
 
wrapInner: function( html ) {
return this.each(function(){
jQuery( this ).contents().wrapAll( html );
});
},
 
wrap: function( html ) {
return this.each(function(){
jQuery( this ).wrapAll( html );
});
},
 
append: function() {
return this.domManip(arguments, true, function(elem){
if (this.nodeType == 1)
this.appendChild( elem );
});
},
 
prepend: function() {
return this.domManip(arguments, true, function(elem){
if (this.nodeType == 1)
this.insertBefore( elem, this.firstChild );
});
},
 
before: function() {
return this.domManip(arguments, false, function(elem){
this.parentNode.insertBefore( elem, this );
});
},
 
after: function() {
return this.domManip(arguments, false, function(elem){
this.parentNode.insertBefore( elem, this.nextSibling );
});
},
 
clone: function( events ) {
// Do the clone
var ret = this.map(function(){
if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
// IE copies events bound via attachEvent when
// 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
// as properties will not be copied (such as the
// the name attribute on an input).
var html = this.outerHTML, ownerDocument = this.ownerDocument;
if ( !html ) {
var div = ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
html = div.innerHTML;
}
 
return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")], ownerDocument)[0];
} else
return this.cloneNode(true);
});
 
// Copy the events from the original to the clone
if ( events === true ) {
var orig = this.find("*").andSelf(), i = 0;
 
ret.find("*").andSelf().each(function(){
if ( this.nodeName !== orig[i].nodeName )
return;
 
var events = jQuery.data( orig[i], "events" );
 
for ( var type in events ) {
for ( var handler in events[ type ] ) {
jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
}
}
 
i++;
});
}
 
// Return the cloned set
return ret;
},
 
html: function( value ) {
return value === undefined ?
(this[0] ?
this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
null) :
this.empty().append( value );
},
 
replaceWith: function( value ) {
return this.after( value ).remove();
},
 
domManip: function( 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 ( 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 ( scripts )
jQuery.each( scripts, evalScript );
}
 
return this;
 
function root( elem, cur ) {
return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
}
});
 
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function(name, original){
jQuery.fn[ name ] = function( selector ) {
var ret = [], insert = jQuery( selector );
 
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = (i > 0 ? this.clone(true) : this).get();
jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
ret = ret.concat( elems );
}
 
return this.pushStack( ret, name, selector );
};
});
 
jQuery.each({
remove: function( selector ) {
if ( !selector || jQuery.multiFilter( selector, [ this ] ).length ) {
if ( this.nodeType === 1 ) {
cleanData( this.getElementsByTagName("*") );
cleanData( [this] );
}
 
if ( this.parentNode ) {
this.parentNode.removeChild( this );
}
}
},
 
empty: function() {
// Remove element nodes and prevent memory leaks
if ( this.nodeType === 1 ) {
cleanData( this.getElementsByTagName("*") );
}
 
// Remove any remaining nodes
while ( this.firstChild ) {
this.removeChild( this.firstChild );
}
}
}, function(name, fn){
jQuery.fn[ name ] = function(){
return this.each( fn, arguments );
};
});
 
jQuery.extend({
clean: function( elems, context, fragment ) {
context = context || document;
 
// !context.createElement fails in IE with an error but returns typeof 'object'
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 )
return [ context.createElement( match[1] ) ];
}
 
var ret = [], scripts = [], div = context.createElement("div");
 
jQuery.each(elems, function(i, elem){
if ( typeof elem === "number" )
elem += '';
 
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 + ">";
});
 
// Trim whitespace, otherwise indexOf won't work as expected
var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase();
 
var wrap =
// option or optgroup
!tags.indexOf("<opt") &&
[ 1, "<select multiple='multiple'>", "</select>" ] ||
 
!tags.indexOf("<leg") &&
[ 1, "<fieldset>", "</fieldset>" ] ||
 
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
[ 1, "<table>", "</table>" ] ||
 
!tags.indexOf("<tr") &&
[ 2, "<table><tbody>", "</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.support.htmlSerialize &&
[ 1, "div<div>", "</div>" ] ||
 
[ 0, "", "" ];
 
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
 
// Move to the right depth
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),
tbody = !tags.indexOf("<table") && !hasBody ?
div.firstChild && div.firstChild.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 )
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 );
 
elem = jQuery.makeArray( div.childNodes );
}
 
if ( elem.nodeType )
ret.push( elem );
else
ret = jQuery.merge( ret, elem );
 
});
 
if ( fragment ) {
for ( var i = 0; ret[i]; i++ ) {
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 )
ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
fragment.appendChild( ret[i] );
}
}
 
return scripts;
}
 
return ret;
}
});
 
function cleanData( elems ) {
for ( var i = 0, l = elems.length; i < l; i++ ) {
var id = elems[i][expando];
if ( id ) {
delete jQuery.cache[ id ];
}
}
}
/*
* A number of helper functions used for managing events.
* Many of the ideas behind this code originated from
2483,7 → 2395,7
 
// Get the current list of functions bound to this event
var handlers = events[type];
 
if ( jQuery.event.specialAll[type] )
jQuery.event.specialAll[type].setup.call(elem, data, namespaces);
 
2543,7 → 2455,7
// Namespaced event handlers
var namespaces = type.split(".");
type = namespaces.shift();
var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
var namespace = new RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
 
if ( events[type] ) {
// remove the given handler for the given type
2556,7 → 2468,7
// Handle the removal of namespaced events
if ( namespace.test(events[type][handle].type) )
delete events[type][handle];
 
if ( jQuery.event.specialAll[type] )
jQuery.event.specialAll[type].teardown.call(elem, namespaces);
 
2623,11 → 2535,11
// don't do events on text and comment nodes
if ( !elem || elem.nodeType == 3 || elem.nodeType == 8 )
return undefined;
 
// Clean up in case it is reused
event.result = undefined;
event.target = elem;
 
// Clone the incoming data, if any
data = jQuery.makeArray(data);
data.unshift( event );
2668,7 → 2580,7
 
event = arguments[0] = jQuery.event.fix( event || window.event );
event.currentTarget = this;
 
// Namespaced event handlers
var namespaces = event.type.split(".");
event.type = namespaces.shift();
2675,9 → 2587,9
 
// Cache this now, all = true means, any handler
all = !namespaces.length && !event.exclusive;
var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
 
var namespace = new RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\\.") + "(\\.|$)");
 
handlers = ( jQuery.data(this, "events") || {} )[event.type];
 
for ( var j in handlers ) {
2773,7 → 2685,7
teardown: function() {}
}
},
 
specialAll: {
live: {
setup: function( selector, namespaces ){
2781,13 → 2693,13
},
teardown: function( namespaces ){
if ( namespaces.length ) {
var remove = 0, name = RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
var remove = 0, name = new RegExp("(^|\\.)" + namespaces[0] + "(\\.|$)");
 
jQuery.each( (jQuery.data(this, "events").live || {}), function(){
if ( name.test(this.type) )
remove++;
});
 
if ( remove < 1 )
jQuery.event.remove( this, namespaces[0], liveHandler );
}
2800,7 → 2712,7
// Allow instantiation without the 'new' keyword
if( !this.preventDefault )
return new jQuery.Event(src);
 
// Event object
if( src && src.type ){
this.originalEvent = src;
2812,7 → 2724,7
// timeStamp is buggy for some events on Firefox(#3843)
// So we won't rely on the native value
this.timeStamp = now();
 
// Mark it as fixed
this[expando] = true;
};
2868,7 → 2780,7
while ( parent && parent != this )
try { parent = parent.parentNode; }
catch(e) { parent = this; }
 
if( parent != this ){
// set the correct event type
event.type = event.data;
2876,9 → 2788,9
jQuery.event.handle.apply( this, arguments );
}
};
jQuery.each({
mouseover: 'mouseenter',
 
jQuery.each({
mouseover: 'mouseenter',
mouseout: 'mouseleave'
}, function( orig, fix ){
jQuery.event.special[ fix ] = {
2888,7 → 2800,7
teardown: function(){
jQuery.event.remove( this, orig, withinElement );
}
};
};
});
 
jQuery.fn.extend({
2927,7 → 2839,7
event.stopPropagation();
jQuery.event.trigger( event, data, this[0] );
return event.result;
}
}
},
 
toggle: function( fn ) {
2970,24 → 2882,24
 
return this;
},
 
live: function( type, fn ){
var proxy = jQuery.event.proxy( fn );
proxy.guid += this.selector + type;
 
jQuery(document).bind( liveConvert(type, this.selector), this.selector, proxy );
jQuery( this.context ).bind( liveConvert(type, this.selector), this.selector, proxy );
 
return this;
},
 
die: function( type, fn ){
jQuery(document).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
jQuery( this.context ).unbind( liveConvert(type, this.selector), fn ? { guid: fn.guid + this.selector + type } : null );
return this;
}
});
 
function liveHandler( event ){
var check = RegExp("(^|\\.)" + event.type + "(\\.|$)"),
var check = new RegExp("(^|\\.)" + event.type + "(\\.|$)"),
stop = true,
elems = [];
 
3002,8 → 2914,9
elems.sort(function(a,b) {
return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
});
 
jQuery.each(elems, function(){
event.currentTarget = this.elem;
if ( this.fn.call(this.elem, event, this.fn.data) === false )
return (stop = false);
});
3103,12 → 3016,15
// Prevent memory leaks in IE
// And prevent errors on refresh with events like mouseover in other browsers
// Window isn't included so as not to unbind existing unload events
jQuery( window ).bind( 'unload', function(){
// More info:
// - http://isaacschlueter.com/2006/10/msie-memory-leaks/
// - https://bugzilla.mozilla.org/show_bug.cgi?id=252542
jQuery( window ).bind( 'unload', function(){
for ( var id in jQuery.cache )
// Skip the window
if ( id != 1 && jQuery.cache[ id ].handle )
jQuery.event.remove( jQuery.cache[ id ].handle.elem );
});
});
(function(){
 
jQuery.support = {};
3119,7 → 3035,7
id = "script" + (new Date).getTime();
 
div.style.display = "none";
div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select>';
 
var all = div.getElementsByTagName("*"),
a = div.getElementsByTagName("a")[0];
3132,32 → 3048,27
jQuery.support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: div.firstChild.nodeType == 3,
 
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that you can get all elements in an <object> element
// IE 7 always returns no results
objectAll: !!div.getElementsByTagName("object")[0]
.getElementsByTagName("*").length,
 
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
 
// Get the style information from getAttribute
// (IE uses .cssText insted)
style: /red/.test( a.getAttribute("style") ),
 
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: a.getAttribute("href") === "/a",
 
// Make sure that element opacity exists
// (IE uses filter instead)
opacity: a.style.opacity === "0.5",
 
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
3167,7 → 3078,7
noCloneEvent: true,
boxModel: null
};
 
script.type = "text/javascript";
try {
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
3174,7 → 3085,7
} catch(e){}
 
root.insertBefore( script, root.firstChild );
 
// Make sure that the execution of code works by injecting a script
// tag with appendChild/createTextNode
// (IE doesn't support this, fails, and uses .text instead)
3186,11 → 3097,11
root.removeChild( script );
 
if ( div.attachEvent && div.fireEvent ) {
div.attachEvent("onclick", function(){
div.attachEvent("onclick", function click(){
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
jQuery.support.noCloneEvent = false;
div.detachEvent("onclick", arguments.callee);
div.detachEvent("onclick", click);
});
div.cloneNode(true).fireEvent("onclick");
}
3207,14 → 3118,9
});
})();
 
var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
 
jQuery.props = {
"for": "htmlFor",
"class": "className",
"float": styleFloat,
cssFloat: styleFloat,
styleFloat: styleFloat,
readonly: "readOnly",
maxlength: "maxLength",
cellspacing: "cellSpacing",
3221,7 → 3127,211
rowspan: "rowSpan",
tabindex: "tabIndex"
};
jQuery.fn.extend({
// exclude the following css properties to add px
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
// cache defaultView
defaultView = document.defaultView || {},
// normalize float css property
styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
 
jQuery.fn.css = function( name, value ) {
var options = name, isFunction = jQuery.isFunction( value );
 
// ignore negative width and height values
if ( (name == 'width' || name == 'height') && parseFloat(value) < 0 )
value = undefined;
 
if ( typeof name === "string" ) {
// Are we setting the style?
if ( value === undefined ) {
return this.length ?
jQuery.css( this[0], name ) :
null;
 
// Convert name, value params to options hash format
} else {
options = {};
options[ name ] = value;
}
}
 
// For each element...
for ( var i = 0, l = this.length; i < l; i++ ) {
var elem = this[i];
 
// Set all the styles
for ( var prop in options ) {
value = options[prop];
 
if ( isFunction ) {
value = value.call( elem, i );
}
 
if ( typeof value === "number" && !exclude.test(prop) ) {
value = value + "px";
}
 
jQuery.style( elem, prop, value );
}
}
 
return this;
};
 
jQuery.extend({
style: function( elem, name, value ) {
// don't set styles on text and comment nodes
if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
return undefined;
 
var style = elem.style || elem, set = value !== undefined;
 
// IE uses filters for 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
style.zoom = 1;
 
// Set the alpha filter to set the opacity
style.filter = (style.filter || "").replace( /alpha\([^)]*\)/, "" ) +
(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
}
 
return style.filter && style.filter.indexOf("opacity=") >= 0 ?
(parseFloat( style.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
"";
}
 
// Make sure we're using the right name for getting the float value
if ( /float/i.test( name ) )
name = styleFloat;
 
name = name.replace(/-([a-z])/ig, function(all, letter){
return letter.toUpperCase();
});
 
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" ];
 
function getWH() {
val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
 
if ( extra === "border" )
return;
 
jQuery.each( which, function() {
if ( !extra )
val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
if ( extra === "margin" )
val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0;
else
val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
});
}
 
if ( elem.offsetWidth !== 0 )
getWH();
else
jQuery.swap( elem, props, getWH );
 
return Math.max(0, Math.round(val));
}
 
return jQuery.curCSS( elem, name, force );
},
 
curCSS: function( elem, name, force ) {
var ret, style = elem.style;
 
// IE uses filters for opacity
if ( !jQuery.support.opacity && name == "opacity" ) {
ret = style.filter && style.filter.indexOf("opacity=") >= 0 ?
(parseFloat( style.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
"";
 
return ret === "" ?
"1" :
ret;
}
 
// Make sure we're using the right name for getting the float value
if ( /float/i.test( name ) )
name = styleFloat;
 
if ( !force && style && style[ name ] ) {
ret = style[ name ];
 
} else if ( defaultView.getComputedStyle ) {
 
// Only "float" is needed here
if ( /float/i.test( name ) )
name = "float";
 
name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
 
var computedStyle = defaultView.getComputedStyle( elem, null );
 
if ( computedStyle )
ret = computedStyle.getPropertyValue( name );
 
// We should always get a number back from opacity
if ( name == "opacity" && ret == "" )
ret = "1";
 
} else if ( elem.currentStyle ) {
var camelCase = name.replace(/\-(\w)/g, function(all, letter){
return letter.toUpperCase();
});
 
ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
 
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
 
// 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 ) ) {
// Remember the original values
var left = style.left, rsLeft = elem.runtimeStyle.left;
 
// Put in the new values to get a computed value out
elem.runtimeStyle.left = elem.currentStyle.left;
style.left = ret || 0;
ret = style.pixelLeft + "px";
 
// Revert the changed values
style.left = left;
elem.runtimeStyle.left = rsLeft;
}
}
 
return ret;
},
 
// 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 ];
elem.style[ name ] = options[ name ];
}
 
callback.call( elem );
 
// Revert the old values
for ( var name in options )
elem.style[ name ] = old[ name ];
}
});jQuery.fn.extend({
// Keep a copy of the old load
_load: jQuery.fn.load,
 
3318,7 → 3428,7
var jsc = now();
 
jQuery.extend({
 
get: function( url, data, callback, type ) {
// shift arguments if data argument was ommited
if ( jQuery.isFunction( data ) ) {
3498,7 → 3608,9
};
}
 
head.appendChild(script);
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
 
// We handle everything using the script element injection
return undefined;
3707,7 → 3819,7
 
if ( xml && data.documentElement.tagName == "parsererror" )
throw "parsererror";
 
// Allow a pre-filtering function to sanitize the response
// s != null is checked to keep backwards compatibility
if( s && s.dataFilter )
3724,7 → 3836,7
if ( type == "json" )
data = window["eval"]("(" + data + ")");
}
 
return data;
},
 
3788,26 → 3900,26
} else {
for ( var i = 0, l = this.length; i < l; i++ ){
var old = jQuery.data(this[i], "olddisplay");
 
this[i].style.display = old || "";
 
if ( jQuery.css(this[i], "display") === "none" ) {
var tagName = this[i].tagName, display;
 
if ( elemdisplay[ tagName ] ) {
display = elemdisplay[ tagName ];
} else {
var elem = jQuery("<" + tagName + " />").appendTo("body");
 
display = elem.css("display");
if ( display === "none" )
display = "block";
 
elem.remove();
 
elemdisplay[ tagName ] = display;
}
 
jQuery.data(this[i], "olddisplay", display);
}
}
3817,7 → 3929,7
for ( var i = 0, l = this.length; i < l; i++ ){
this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
}
 
return this;
}
},
3859,7 → 3971,8
},
 
fadeTo: function(speed,to,callback){
return this.animate({opacity: to}, speed, callback);
return this.filter(":hidden").css('opacity', 0).show().end()
.animate({opacity: to}, speed, callback);
},
 
animate: function( prop, speed, easing, callback ) {
3866,11 → 3979,11
var optall = jQuery.speed(speed, easing, callback);
 
return this[ optall.queue === false ? "each" : "queue" ](function(){
 
var opt = jQuery.extend({}, optall), p,
hidden = this.nodeType == 1 && jQuery(this).is(":hidden"),
self = this;
 
for ( p in prop ) {
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
return opt.complete.call(this);
4068,7 → 4181,7
// Simple 'show' function
show: function(){
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.show = true;
 
// Begin the animation
4083,7 → 4196,7
// Simple 'hide' function
hide: function(){
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
this.options.hide = true;
 
// Begin the animation
4124,8 → 4237,8
// Reset the properties, if the item has been hidden or shown
if ( this.options.hide || this.options.show )
for ( var p in this.options.curAnim )
jQuery.attr(this.elem.style, p, this.options.orig[p]);
jQuery.style(this.elem, p, this.options.orig[p]);
 
// Execute the complete function
this.options.complete.call( this.elem );
}
4158,7 → 4271,7
step: {
 
opacity: function(fx){
jQuery.attr(fx.elem.style, "opacity", fx.now);
jQuery.style(fx.elem, "opacity", fx.now);
},
 
_default: function(fx){
4169,23 → 4282,25
}
}
});
if ( document.documentElement["getBoundingClientRect"] )
if ( "getBoundingClientRect" in document.documentElement )
jQuery.fn.offset = function() {
if ( !this[0] ) return { top: 0, left: 0 };
if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
var box = this[0].getBoundingClientRect(), doc = this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
var elem = this[0];
if ( !elem ) 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.boxModel && docElem.scrollTop || body.scrollTop ) - clientTop,
left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft;
return { top: top, left: left };
};
else
else
jQuery.fn.offset = function() {
if ( !this[0] ) return { top: 0, left: 0 };
if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] );
jQuery.offset.initialized || jQuery.offset.initialize();
var elem = this[0];
if ( !elem ) return null;
if ( elem === elem.ownerDocument.body ) return jQuery.offset.bodyOffset( elem );
jQuery.offset.initialize();
 
var elem = this[0], offsetParent = elem.offsetParent, prevOffsetParent = elem,
var offsetParent = elem.offsetParent, prevOffsetParent = elem,
doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
body = doc.body, defaultView = doc.defaultView,
prevComputedStyle = defaultView.getComputedStyle(elem, null),
4192,18 → 4307,19
top = elem.offsetTop, left = elem.offsetLeft;
 
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) break;
computedStyle = defaultView.getComputedStyle(elem, null);
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 += parseInt( computedStyle.borderTopWidth, 10) || 0,
left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
top += parseFloat( computedStyle.borderTopWidth, 10) || 0,
left += parseFloat( computedStyle.borderLeftWidth, 10) || 0;
prevOffsetParent = offsetParent, offsetParent = elem.offsetParent;
}
if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" )
top += parseInt( computedStyle.borderTopWidth, 10) || 0,
left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
top += parseFloat( computedStyle.borderTopWidth, 10) || 0,
left += parseFloat( computedStyle.borderLeftWidth, 10) || 0;
prevComputedStyle = computedStyle;
}
 
4211,7 → 4327,7
top += body.offsetTop,
left += body.offsetLeft;
 
if ( prevComputedStyle.position === "fixed" )
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" )
top += Math.max(docElem.scrollTop, body.scrollTop),
left += Math.max(docElem.scrollLeft, body.scrollLeft);
 
4220,12 → 4336,10
 
jQuery.offset = {
initialize: function() {
if ( this.initialized ) return;
var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, prop, bodyMarginTop = body.style.marginTop,
html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';
 
rules = { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' };
for ( prop in rules ) container.style[prop] = rules[prop];
jQuery.extend( container.style, { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' } );
 
container.innerHTML = html;
body.insertBefore(container, body.firstChild);
4234,6 → 4348,10
this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
 
checkDiv.style.position = 'fixed', checkDiv.style.top = '20px';
this.supportsFixedPosition = (checkDiv.offsetTop >= 15); // safari subtracts parent border width here which is 5px
checkDiv.style.position = '', checkDiv.style.top = '';
 
innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative';
this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
 
4242,15 → 4360,15
body.style.marginTop = bodyMarginTop;
 
body.removeChild(container);
this.initialized = true;
jQuery.offset.initialize = function(){};
},
 
bodyOffset: function(body) {
jQuery.offset.initialized || jQuery.offset.initialize();
jQuery.offset.initialize();
var top = body.offsetTop, left = body.offsetLeft;
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0,
left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
top += parseFloat( jQuery.curCSS(body, 'marginTop', true), 10 ) || 0,
left += parseFloat( jQuery.curCSS(body, 'marginLeft', true), 10 ) || 0;
return { top: top, left: left };
}
};
4258,33 → 4376,33
 
jQuery.fn.extend({
position: function() {
var left = 0, top = 0, results;
if ( !this[0] ) return null;
 
if ( this[0] ) {
// Get *real* offsetParent
var offsetParent = this.offsetParent(),
var elem = this[0], left = 0, top = 0, results,
 
// Get correct offsets
offset = this.offset(),
parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
// Get *real* offsetParent
offsetParent = this.offsetParent(),
 
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= num( this, 'marginTop' );
offset.left -= num( this, 'marginLeft' );
// Get correct offsets
offset = this.offset(),
parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset();
 
// Add offsetParent borders
parentOffset.top += num( offsetParent, 'borderTopWidth' );
parentOffset.left += num( offsetParent, 'borderLeftWidth' );
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.curCSS(elem, 'marginTop', true), 10 ) || 0;
offset.left -= parseFloat( jQuery.curCSS(elem, 'marginLeft', true), 10 ) || 0;
 
// Subtract the two offsets
results = {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
}
// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.curCSS(offsetParent[0], 'borderTopWidth', true), 10 ) || 0;
parentOffset.left += parseFloat( jQuery.curCSS(offsetParent[0], 'borderLeftWidth', true), 10 ) || 0;
 
// Subtract the two offsets
results = {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
 
return results;
},
 
4300,9 → 4418,9
// Create scrollLeft and scrollTop methods
jQuery.each( ['Left', 'Top'], function(i, name) {
var method = 'scroll' + name;
 
jQuery.fn[ method ] = function(val) {
if (!this[0]) return null;
if ( !this[0] ) return null;
 
return val !== undefined ?
 
4327,14 → 4445,12
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function(i, name){
 
var tl = i ? "Left" : "Top", // top or left
br = i ? "Right" : "Bottom", // bottom or right
lower = name.toLowerCase();
var type = name.toLowerCase();
 
// innerHeight and innerWidth
jQuery.fn["inner" + name] = function(){
return this[0] ?
jQuery.css( this[0], lower, false, "padding" ) :
jQuery.css( this[0], type, false, "padding" ) :
null;
};
 
4341,11 → 4457,9
// outerHeight and outerWidth
jQuery.fn["outer" + name] = function(margin) {
return this[0] ?
jQuery.css( this[0], lower, false, margin ? "margin" : "border" ) :
jQuery.css( this[0], type, false, margin ? "margin" : "border" ) :
null;
};
var type = name.toLowerCase();
 
jQuery.fn[ type ] = function( size ) {
// Get window width or height