Remove trailing whitespace and add final newlines

This commit is contained in:
Trey Hunner 2012-10-21 18:50:03 -07:00 committed by Jörn Zaefferer
parent 0bcbfe7146
commit 49f9b849b9
45 changed files with 440 additions and 440 deletions

106
tests/jquery-1.6.1.js vendored
View File

@ -1895,11 +1895,11 @@ jQuery.fn.extend({
jQuery.removeAttr( this, name ); jQuery.removeAttr( this, name );
}); });
}, },
prop: function( name, value ) { prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop ); return jQuery.access( this, name, value, true, jQuery.prop );
}, },
removeProp: function( name ) { removeProp: function( name ) {
name = jQuery.propFix[ name ] || name; name = jQuery.propFix[ name ] || name;
return this.each(function() { return this.each(function() {
@ -2031,7 +2031,7 @@ jQuery.fn.extend({
val: function( value ) { val: function( value ) {
var hooks, ret, var hooks, ret,
elem = this[0]; elem = this[0];
if ( !arguments.length ) { if ( !arguments.length ) {
if ( elem ) { if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
@ -2159,15 +2159,15 @@ jQuery.extend({
height: true, height: true,
offset: true offset: true
}, },
attrFix: { attrFix: {
// Always normalize to ensure hook usage // Always normalize to ensure hook usage
tabindex: "tabIndex" tabindex: "tabIndex"
}, },
attr: function( elem, name, value, pass ) { attr: function( elem, name, value, pass ) {
var nType = elem.nodeType; var nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes // don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined; return undefined;
@ -2235,7 +2235,7 @@ jQuery.extend({
var propName; var propName;
if ( elem.nodeType === 1 ) { if ( elem.nodeType === 1 ) {
name = jQuery.attrFix[ name ] || name; name = jQuery.attrFix[ name ] || name;
if ( jQuery.support.getSetAttribute ) { if ( jQuery.support.getSetAttribute ) {
// Use removeAttribute in browsers that support it // Use removeAttribute in browsers that support it
elem.removeAttribute( name ); elem.removeAttribute( name );
@ -2299,7 +2299,7 @@ jQuery.extend({
frameborder: "frameBorder", frameborder: "frameBorder",
contenteditable: "contentEditable" contenteditable: "contentEditable"
}, },
prop: function( elem, name, value ) { prop: function( elem, name, value ) {
var nType = elem.nodeType; var nType = elem.nodeType;
@ -2313,7 +2313,7 @@ jQuery.extend({
// Try to normalize/fix the name // Try to normalize/fix the name
name = notxml && jQuery.propFix[ name ] || name; name = notxml && jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ]; hooks = jQuery.propHooks[ name ];
if ( value !== undefined ) { if ( value !== undefined ) {
@ -2333,7 +2333,7 @@ jQuery.extend({
} }
} }
}, },
propHooks: {} propHooks: {}
}); });
@ -2388,7 +2388,7 @@ if ( !jQuery.support.getSetAttribute ) {
// propFix is more comprehensive and contains all fixes // propFix is more comprehensive and contains all fixes
jQuery.attrFix = jQuery.propFix; jQuery.attrFix = jQuery.propFix;
// Use this for any attribute on a form in IE6/7 // Use this for any attribute on a form in IE6/7
formHook = jQuery.attrHooks.name = jQuery.valHooks.button = { formHook = jQuery.attrHooks.name = jQuery.valHooks.button = {
get: function( elem, name ) { get: function( elem, name ) {
@ -2759,7 +2759,7 @@ jQuery.event = {
} }
} }
}, },
// Events that are safe to short-circuit if no handlers are attached. // Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers. // Native DOM events should not be added, they may have inline handlers.
customEvent: { customEvent: {
@ -2805,7 +2805,7 @@ jQuery.event = {
event.exclusive = exclusive; event.exclusive = exclusive;
event.namespace = namespaces.join("."); event.namespace = namespaces.join(".");
event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
// triggerHandler() and global events don't bubble or run the default action // triggerHandler() and global events don't bubble or run the default action
if ( onlyHandlers || !elem ) { if ( onlyHandlers || !elem ) {
event.preventDefault(); event.preventDefault();
@ -2896,7 +2896,7 @@ jQuery.event = {
jQuery.event.triggered = undefined; jQuery.event.triggered = undefined;
} }
} }
return event.result; return event.result;
}, },
@ -3731,7 +3731,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( context.nodeType !== 1 && context.nodeType !== 9 ) { if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return []; return [];
} }
if ( !selector || typeof selector !== "string" ) { if ( !selector || typeof selector !== "string" ) {
return results; return results;
} }
@ -3741,7 +3741,7 @@ var Sizzle = function( selector, context, results, seed ) {
contextXML = Sizzle.isXML( context ), contextXML = Sizzle.isXML( context ),
parts = [], parts = [],
soFar = selector; soFar = selector;
// Reset the position of the chunker regexp (start from head) // Reset the position of the chunker regexp (start from head)
do { do {
chunker.exec( "" ); chunker.exec( "" );
@ -3749,9 +3749,9 @@ var Sizzle = function( selector, context, results, seed ) {
if ( m ) { if ( m ) {
soFar = m[3]; soFar = m[3];
parts.push( m[1] ); parts.push( m[1] );
if ( m[2] ) { if ( m[2] ) {
extra = m[3]; extra = m[3];
break; break;
@ -3775,7 +3775,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( Expr.relative[ selector ] ) { if ( Expr.relative[ selector ] ) {
selector += parts.shift(); selector += parts.shift();
} }
set = posProcess( selector, set ); set = posProcess( selector, set );
} }
} }
@ -3904,7 +3904,7 @@ Sizzle.find = function( expr, context, isXML ) {
for ( var i = 0, l = Expr.order.length; i < l; i++ ) { for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var match, var match,
type = Expr.order[i]; type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
var left = match[1]; var left = match[1];
match.splice( 1, 1 ); match.splice( 1, 1 );
@ -4236,7 +4236,7 @@ var Expr = Sizzle.selectors = {
ATTR: function( match, curLoop, inplace, result, not, isXML ) { ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" ); var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) { if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name]; match[1] = Expr.attrMap[name];
} }
@ -4270,7 +4270,7 @@ var Expr = Sizzle.selectors = {
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true; return true;
} }
return match; return match;
}, },
@ -4280,7 +4280,7 @@ var Expr = Sizzle.selectors = {
return match; return match;
} }
}, },
filters: { filters: {
enabled: function( elem ) { enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden"; return elem.disabled === false && elem.type !== "hidden";
@ -4293,14 +4293,14 @@ var Expr = Sizzle.selectors = {
checked: function( elem ) { checked: function( elem ) {
return elem.checked === true; return elem.checked === true;
}, },
selected: function( elem ) { selected: function( elem ) {
// Accessing this property makes selected-by-default // Accessing this property makes selected-by-default
// options in Safari work properly // options in Safari work properly
if ( elem.parentNode ) { if ( elem.parentNode ) {
elem.parentNode.selectedIndex; elem.parentNode.selectedIndex;
} }
return elem.selected === true; return elem.selected === true;
}, },
@ -4322,7 +4322,7 @@ var Expr = Sizzle.selectors = {
text: function( elem ) { text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type; var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case // use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
}, },
@ -4438,21 +4438,21 @@ var Expr = Sizzle.selectors = {
case "only": case "only":
case "first": case "first":
while ( (node = node.previousSibling) ) { while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
if ( type === "first" ) { if ( type === "first" ) {
return true; return true;
} }
node = elem; node = elem;
case "last": case "last":
while ( (node = node.nextSibling) ) { while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
@ -4465,22 +4465,22 @@ var Expr = Sizzle.selectors = {
if ( first === 1 && last === 0 ) { if ( first === 1 && last === 0 ) {
return true; return true;
} }
var doneName = match[0], var doneName = match[0],
parent = elem.parentNode; parent = elem.parentNode;
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0; var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) { for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
node.nodeIndex = ++count; node.nodeIndex = ++count;
} }
} }
parent.sizcache = doneName; parent.sizcache = doneName;
} }
var diff = elem.nodeIndex - last; var diff = elem.nodeIndex - last;
if ( first === 0 ) { if ( first === 0 ) {
@ -4499,7 +4499,7 @@ var Expr = Sizzle.selectors = {
TAG: function( elem, match ) { TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
}, },
CLASS: function( elem, match ) { CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ") return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1; .indexOf( match ) > -1;
@ -4565,7 +4565,7 @@ var makeArray = function( array, results ) {
results.push.apply( results, array ); results.push.apply( results, array );
return results; return results;
} }
return array; return array;
}; };
@ -4817,7 +4817,7 @@ if ( document.querySelectorAll ) {
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return; return;
} }
Sizzle = function( query, context, extra, seed ) { Sizzle = function( query, context, extra, seed ) {
context = context || document; context = context || document;
@ -4826,24 +4826,24 @@ if ( document.querySelectorAll ) {
if ( !seed && !Sizzle.isXML(context) ) { if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up // See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG") // Speed-up: Sizzle("TAG")
if ( match[1] ) { if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra ); return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS") // Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra ); return makeArray( context.getElementsByClassName( match[2] ), extra );
} }
} }
if ( context.nodeType === 9 ) { if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body") // Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it // The body element only exists once, optimize finding it
if ( query === "body" && context.body ) { if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra ); return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID") // Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) { } else if ( match && match[3] ) {
var elem = context.getElementById( match[3] ); var elem = context.getElementById( match[3] );
@ -4856,12 +4856,12 @@ if ( document.querySelectorAll ) {
if ( elem.id === match[3] ) { if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra ); return makeArray( [ elem ], extra );
} }
} else { } else {
return makeArray( [], extra ); return makeArray( [], extra );
} }
} }
try { try {
return makeArray( context.querySelectorAll(query), extra ); return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {} } catch(qsaError) {}
@ -4899,7 +4899,7 @@ if ( document.querySelectorAll ) {
} }
} }
} }
return oldSizzle(query, context, extra, seed); return oldSizzle(query, context, extra, seed);
}; };
@ -4926,7 +4926,7 @@ if ( document.querySelectorAll ) {
// This should fail with an exception // This should fail with an exception
// Gecko does not error, returns false instead // Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" ); matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) { } catch( pseudoError ) {
pseudoWorks = true; pseudoWorks = true;
} }
@ -4936,7 +4936,7 @@ if ( document.querySelectorAll ) {
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) { if ( !Sizzle.isXML( node ) ) {
try { try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr ); var ret = matches.call( node, expr );
@ -4973,7 +4973,7 @@ if ( document.querySelectorAll ) {
if ( div.getElementsByClassName("e").length === 1 ) { if ( div.getElementsByClassName("e").length === 1 ) {
return; return;
} }
Expr.order.splice(1, 0, "CLASS"); Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) { Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
@ -5024,7 +5024,7 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
if ( elem ) { if ( elem ) {
var match = false; var match = false;
elem = elem[dir]; elem = elem[dir];
while ( elem ) { while ( elem ) {
@ -5077,7 +5077,7 @@ if ( document.documentElement.contains ) {
Sizzle.isXML = function( elem ) { Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist // documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833) // (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false; return documentElement ? documentElement.nodeName !== "HTML" : false;
@ -5198,7 +5198,7 @@ jQuery.fn.extend({
closest: function( selectors, context ) { closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0]; var ret = [], i, l, cur = this[0];
// Array // Array
if ( jQuery.isArray( selectors ) ) { if ( jQuery.isArray( selectors ) ) {
var match, selector, var match, selector,

110
tests/jquery-1.6.2.js vendored
View File

@ -1511,7 +1511,7 @@ jQuery.extend({
return thisCache[ internalKey ] && thisCache[ internalKey ].events; return thisCache[ internalKey ] && thisCache[ internalKey ].events;
} }
return getByName ? return getByName ?
// Check for both converted-to-camel and non-converted data property names // Check for both converted-to-camel and non-converted data property names
thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] : thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] :
thisCache; thisCache;
@ -1923,11 +1923,11 @@ jQuery.fn.extend({
jQuery.removeAttr( this, name ); jQuery.removeAttr( this, name );
}); });
}, },
prop: function( name, value ) { prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop ); return jQuery.access( this, name, value, true, jQuery.prop );
}, },
removeProp: function( name ) { removeProp: function( name ) {
name = jQuery.propFix[ name ] || name; name = jQuery.propFix[ name ] || name;
return this.each(function() { return this.each(function() {
@ -2060,7 +2060,7 @@ jQuery.fn.extend({
val: function( value ) { val: function( value ) {
var hooks, ret, var hooks, ret,
elem = this[0]; elem = this[0];
if ( !arguments.length ) { if ( !arguments.length ) {
if ( elem ) { if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
@ -2071,9 +2071,9 @@ jQuery.fn.extend({
ret = elem.value; ret = elem.value;
return typeof ret === "string" ? return typeof ret === "string" ?
// handle most common string cases // handle most common string cases
ret.replace(rreturn, "") : ret.replace(rreturn, "") :
// handle cases where value is null/undef or number // handle cases where value is null/undef or number
ret == null ? "" : ret; ret == null ? "" : ret;
} }
@ -2194,15 +2194,15 @@ jQuery.extend({
height: true, height: true,
offset: true offset: true
}, },
attrFix: { attrFix: {
// Always normalize to ensure hook usage // Always normalize to ensure hook usage
tabindex: "tabIndex" tabindex: "tabIndex"
}, },
attr: function( elem, name, value, pass ) { attr: function( elem, name, value, pass ) {
var nType = elem.nodeType; var nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes // don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined; return undefined;
@ -2273,7 +2273,7 @@ jQuery.extend({
var propName; var propName;
if ( elem.nodeType === 1 ) { if ( elem.nodeType === 1 ) {
name = jQuery.attrFix[ name ] || name; name = jQuery.attrFix[ name ] || name;
if ( jQuery.support.getSetAttribute ) { if ( jQuery.support.getSetAttribute ) {
// Use removeAttribute in browsers that support it // Use removeAttribute in browsers that support it
elem.removeAttribute( name ); elem.removeAttribute( name );
@ -2356,7 +2356,7 @@ jQuery.extend({
frameborder: "frameBorder", frameborder: "frameBorder",
contenteditable: "contentEditable" contenteditable: "contentEditable"
}, },
prop: function( elem, name, value ) { prop: function( elem, name, value ) {
var nType = elem.nodeType; var nType = elem.nodeType;
@ -2391,7 +2391,7 @@ jQuery.extend({
} }
} }
}, },
propHooks: {} propHooks: {}
}); });
@ -2428,7 +2428,7 @@ if ( !jQuery.support.getSetAttribute ) {
// propFix is more comprehensive and contains all fixes // propFix is more comprehensive and contains all fixes
jQuery.attrFix = jQuery.propFix; jQuery.attrFix = jQuery.propFix;
// Use this for any attribute on a form in IE6/7 // Use this for any attribute on a form in IE6/7
formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = { formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = {
get: function( elem, name ) { get: function( elem, name ) {
@ -2798,7 +2798,7 @@ jQuery.event = {
} }
} }
}, },
// Events that are safe to short-circuit if no handlers are attached. // Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers. // Native DOM events should not be added, they may have inline handlers.
customEvent: { customEvent: {
@ -2844,7 +2844,7 @@ jQuery.event = {
event.exclusive = exclusive; event.exclusive = exclusive;
event.namespace = namespaces.join("."); event.namespace = namespaces.join(".");
event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
// triggerHandler() and global events don't bubble or run the default action // triggerHandler() and global events don't bubble or run the default action
if ( onlyHandlers || !elem ) { if ( onlyHandlers || !elem ) {
event.preventDefault(); event.preventDefault();
@ -2935,7 +2935,7 @@ jQuery.event = {
jQuery.event.triggered = undefined; jQuery.event.triggered = undefined;
} }
} }
return event.result; return event.result;
}, },
@ -3763,7 +3763,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( context.nodeType !== 1 && context.nodeType !== 9 ) { if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return []; return [];
} }
if ( !selector || typeof selector !== "string" ) { if ( !selector || typeof selector !== "string" ) {
return results; return results;
} }
@ -3773,7 +3773,7 @@ var Sizzle = function( selector, context, results, seed ) {
contextXML = Sizzle.isXML( context ), contextXML = Sizzle.isXML( context ),
parts = [], parts = [],
soFar = selector; soFar = selector;
// Reset the position of the chunker regexp (start from head) // Reset the position of the chunker regexp (start from head)
do { do {
chunker.exec( "" ); chunker.exec( "" );
@ -3781,9 +3781,9 @@ var Sizzle = function( selector, context, results, seed ) {
if ( m ) { if ( m ) {
soFar = m[3]; soFar = m[3];
parts.push( m[1] ); parts.push( m[1] );
if ( m[2] ) { if ( m[2] ) {
extra = m[3]; extra = m[3];
break; break;
@ -3807,7 +3807,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( Expr.relative[ selector ] ) { if ( Expr.relative[ selector ] ) {
selector += parts.shift(); selector += parts.shift();
} }
set = posProcess( selector, set ); set = posProcess( selector, set );
} }
} }
@ -3936,7 +3936,7 @@ Sizzle.find = function( expr, context, isXML ) {
for ( var i = 0, l = Expr.order.length; i < l; i++ ) { for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var match, var match,
type = Expr.order[i]; type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
var left = match[1]; var left = match[1];
match.splice( 1, 1 ); match.splice( 1, 1 );
@ -4268,7 +4268,7 @@ var Expr = Sizzle.selectors = {
ATTR: function( match, curLoop, inplace, result, not, isXML ) { ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" ); var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) { if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name]; match[1] = Expr.attrMap[name];
} }
@ -4302,7 +4302,7 @@ var Expr = Sizzle.selectors = {
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true; return true;
} }
return match; return match;
}, },
@ -4312,7 +4312,7 @@ var Expr = Sizzle.selectors = {
return match; return match;
} }
}, },
filters: { filters: {
enabled: function( elem ) { enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden"; return elem.disabled === false && elem.type !== "hidden";
@ -4325,14 +4325,14 @@ var Expr = Sizzle.selectors = {
checked: function( elem ) { checked: function( elem ) {
return elem.checked === true; return elem.checked === true;
}, },
selected: function( elem ) { selected: function( elem ) {
// Accessing this property makes selected-by-default // Accessing this property makes selected-by-default
// options in Safari work properly // options in Safari work properly
if ( elem.parentNode ) { if ( elem.parentNode ) {
elem.parentNode.selectedIndex; elem.parentNode.selectedIndex;
} }
return elem.selected === true; return elem.selected === true;
}, },
@ -4354,7 +4354,7 @@ var Expr = Sizzle.selectors = {
text: function( elem ) { text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type; var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case // use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
}, },
@ -4470,21 +4470,21 @@ var Expr = Sizzle.selectors = {
case "only": case "only":
case "first": case "first":
while ( (node = node.previousSibling) ) { while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
if ( type === "first" ) { if ( type === "first" ) {
return true; return true;
} }
node = elem; node = elem;
case "last": case "last":
while ( (node = node.nextSibling) ) { while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
@ -4497,22 +4497,22 @@ var Expr = Sizzle.selectors = {
if ( first === 1 && last === 0 ) { if ( first === 1 && last === 0 ) {
return true; return true;
} }
var doneName = match[0], var doneName = match[0],
parent = elem.parentNode; parent = elem.parentNode;
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0; var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) { for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
node.nodeIndex = ++count; node.nodeIndex = ++count;
} }
} }
parent.sizcache = doneName; parent.sizcache = doneName;
} }
var diff = elem.nodeIndex - last; var diff = elem.nodeIndex - last;
if ( first === 0 ) { if ( first === 0 ) {
@ -4531,7 +4531,7 @@ var Expr = Sizzle.selectors = {
TAG: function( elem, match ) { TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
}, },
CLASS: function( elem, match ) { CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ") return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1; .indexOf( match ) > -1;
@ -4597,7 +4597,7 @@ var makeArray = function( array, results ) {
results.push.apply( results, array ); results.push.apply( results, array );
return results; return results;
} }
return array; return array;
}; };
@ -4849,7 +4849,7 @@ if ( document.querySelectorAll ) {
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return; return;
} }
Sizzle = function( query, context, extra, seed ) { Sizzle = function( query, context, extra, seed ) {
context = context || document; context = context || document;
@ -4858,24 +4858,24 @@ if ( document.querySelectorAll ) {
if ( !seed && !Sizzle.isXML(context) ) { if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up // See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG") // Speed-up: Sizzle("TAG")
if ( match[1] ) { if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra ); return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS") // Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra ); return makeArray( context.getElementsByClassName( match[2] ), extra );
} }
} }
if ( context.nodeType === 9 ) { if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body") // Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it // The body element only exists once, optimize finding it
if ( query === "body" && context.body ) { if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra ); return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID") // Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) { } else if ( match && match[3] ) {
var elem = context.getElementById( match[3] ); var elem = context.getElementById( match[3] );
@ -4888,12 +4888,12 @@ if ( document.querySelectorAll ) {
if ( elem.id === match[3] ) { if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra ); return makeArray( [ elem ], extra );
} }
} else { } else {
return makeArray( [], extra ); return makeArray( [], extra );
} }
} }
try { try {
return makeArray( context.querySelectorAll(query), extra ); return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {} } catch(qsaError) {}
@ -4931,7 +4931,7 @@ if ( document.querySelectorAll ) {
} }
} }
} }
return oldSizzle(query, context, extra, seed); return oldSizzle(query, context, extra, seed);
}; };
@ -4958,7 +4958,7 @@ if ( document.querySelectorAll ) {
// This should fail with an exception // This should fail with an exception
// Gecko does not error, returns false instead // Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" ); matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) { } catch( pseudoError ) {
pseudoWorks = true; pseudoWorks = true;
} }
@ -4968,7 +4968,7 @@ if ( document.querySelectorAll ) {
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) { if ( !Sizzle.isXML( node ) ) {
try { try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr ); var ret = matches.call( node, expr );
@ -5005,7 +5005,7 @@ if ( document.querySelectorAll ) {
if ( div.getElementsByClassName("e").length === 1 ) { if ( div.getElementsByClassName("e").length === 1 ) {
return; return;
} }
Expr.order.splice(1, 0, "CLASS"); Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) { Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
@ -5056,7 +5056,7 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
if ( elem ) { if ( elem ) {
var match = false; var match = false;
elem = elem[dir]; elem = elem[dir];
while ( elem ) { while ( elem ) {
@ -5109,7 +5109,7 @@ if ( document.documentElement.contains ) {
Sizzle.isXML = function( elem ) { Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist // documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833) // (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false; return documentElement ? documentElement.nodeName !== "HTML" : false;
@ -5230,7 +5230,7 @@ jQuery.fn.extend({
closest: function( selectors, context ) { closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0]; var ret = [], i, l, cur = this[0];
// Array // Array
if ( jQuery.isArray( selectors ) ) { if ( jQuery.isArray( selectors ) ) {
var match, selector, var match, selector,

108
tests/jquery-1.6.3.js vendored
View File

@ -1961,11 +1961,11 @@ jQuery.fn.extend({
jQuery.removeAttr( this, name ); jQuery.removeAttr( this, name );
}); });
}, },
prop: function( name, value ) { prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop ); return jQuery.access( this, name, value, true, jQuery.prop );
}, },
removeProp: function( name ) { removeProp: function( name ) {
name = jQuery.propFix[ name ] || name; name = jQuery.propFix[ name ] || name;
return this.each(function() { return this.each(function() {
@ -2098,7 +2098,7 @@ jQuery.fn.extend({
val: function( value ) { val: function( value ) {
var hooks, ret, var hooks, ret,
elem = this[0]; elem = this[0];
if ( !arguments.length ) { if ( !arguments.length ) {
if ( elem ) { if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
@ -2109,9 +2109,9 @@ jQuery.fn.extend({
ret = elem.value; ret = elem.value;
return typeof ret === "string" ? return typeof ret === "string" ?
// handle most common string cases // handle most common string cases
ret.replace(rreturn, "") : ret.replace(rreturn, "") :
// handle cases where value is null/undef or number // handle cases where value is null/undef or number
ret == null ? "" : ret; ret == null ? "" : ret;
} }
@ -2232,15 +2232,15 @@ jQuery.extend({
height: true, height: true,
offset: true offset: true
}, },
attrFix: { attrFix: {
// Always normalize to ensure hook usage // Always normalize to ensure hook usage
tabindex: "tabIndex" tabindex: "tabIndex"
}, },
attr: function( elem, name, value, pass ) { attr: function( elem, name, value, pass ) {
var nType = elem.nodeType; var nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes // don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined; return undefined;
@ -2373,7 +2373,7 @@ jQuery.extend({
frameborder: "frameBorder", frameborder: "frameBorder",
contenteditable: "contentEditable" contenteditable: "contentEditable"
}, },
prop: function( elem, name, value ) { prop: function( elem, name, value ) {
var nType = elem.nodeType; var nType = elem.nodeType;
@ -2408,7 +2408,7 @@ jQuery.extend({
} }
} }
}, },
propHooks: { propHooks: {
tabIndex: { tabIndex: {
get: function( elem ) { get: function( elem ) {
@ -2461,7 +2461,7 @@ boolHook = {
// IE6/7 do not support getting/setting some attributes with get/setAttribute // IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !jQuery.support.getSetAttribute ) { if ( !jQuery.support.getSetAttribute ) {
// Use this for any attribute in IE6/7 // Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue // This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = { nodeHook = jQuery.valHooks.button = {
@ -2833,7 +2833,7 @@ jQuery.event = {
} }
} }
}, },
// Events that are safe to short-circuit if no handlers are attached. // Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers. // Native DOM events should not be added, they may have inline handlers.
customEvent: { customEvent: {
@ -2879,7 +2879,7 @@ jQuery.event = {
event.exclusive = exclusive; event.exclusive = exclusive;
event.namespace = namespaces.join("."); event.namespace = namespaces.join(".");
event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
// triggerHandler() and global events don't bubble or run the default action // triggerHandler() and global events don't bubble or run the default action
if ( onlyHandlers || !elem ) { if ( onlyHandlers || !elem ) {
event.preventDefault(); event.preventDefault();
@ -2970,7 +2970,7 @@ jQuery.event = {
jQuery.event.triggered = undefined; jQuery.event.triggered = undefined;
} }
} }
return event.result; return event.result;
}, },
@ -3799,7 +3799,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( context.nodeType !== 1 && context.nodeType !== 9 ) { if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return []; return [];
} }
if ( !selector || typeof selector !== "string" ) { if ( !selector || typeof selector !== "string" ) {
return results; return results;
} }
@ -3809,7 +3809,7 @@ var Sizzle = function( selector, context, results, seed ) {
contextXML = Sizzle.isXML( context ), contextXML = Sizzle.isXML( context ),
parts = [], parts = [],
soFar = selector; soFar = selector;
// Reset the position of the chunker regexp (start from head) // Reset the position of the chunker regexp (start from head)
do { do {
chunker.exec( "" ); chunker.exec( "" );
@ -3817,9 +3817,9 @@ var Sizzle = function( selector, context, results, seed ) {
if ( m ) { if ( m ) {
soFar = m[3]; soFar = m[3];
parts.push( m[1] ); parts.push( m[1] );
if ( m[2] ) { if ( m[2] ) {
extra = m[3]; extra = m[3];
break; break;
@ -3843,7 +3843,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( Expr.relative[ selector ] ) { if ( Expr.relative[ selector ] ) {
selector += parts.shift(); selector += parts.shift();
} }
set = posProcess( selector, set ); set = posProcess( selector, set );
} }
} }
@ -3972,7 +3972,7 @@ Sizzle.find = function( expr, context, isXML ) {
for ( var i = 0, l = Expr.order.length; i < l; i++ ) { for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var match, var match,
type = Expr.order[i]; type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
var left = match[1]; var left = match[1];
match.splice( 1, 1 ); match.splice( 1, 1 );
@ -4304,7 +4304,7 @@ var Expr = Sizzle.selectors = {
ATTR: function( match, curLoop, inplace, result, not, isXML ) { ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" ); var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) { if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name]; match[1] = Expr.attrMap[name];
} }
@ -4338,7 +4338,7 @@ var Expr = Sizzle.selectors = {
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true; return true;
} }
return match; return match;
}, },
@ -4348,7 +4348,7 @@ var Expr = Sizzle.selectors = {
return match; return match;
} }
}, },
filters: { filters: {
enabled: function( elem ) { enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden"; return elem.disabled === false && elem.type !== "hidden";
@ -4361,14 +4361,14 @@ var Expr = Sizzle.selectors = {
checked: function( elem ) { checked: function( elem ) {
return elem.checked === true; return elem.checked === true;
}, },
selected: function( elem ) { selected: function( elem ) {
// Accessing this property makes selected-by-default // Accessing this property makes selected-by-default
// options in Safari work properly // options in Safari work properly
if ( elem.parentNode ) { if ( elem.parentNode ) {
elem.parentNode.selectedIndex; elem.parentNode.selectedIndex;
} }
return elem.selected === true; return elem.selected === true;
}, },
@ -4390,7 +4390,7 @@ var Expr = Sizzle.selectors = {
text: function( elem ) { text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type; var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case // use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
}, },
@ -4506,21 +4506,21 @@ var Expr = Sizzle.selectors = {
case "only": case "only":
case "first": case "first":
while ( (node = node.previousSibling) ) { while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
if ( type === "first" ) { if ( type === "first" ) {
return true; return true;
} }
node = elem; node = elem;
case "last": case "last":
while ( (node = node.nextSibling) ) { while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
@ -4533,22 +4533,22 @@ var Expr = Sizzle.selectors = {
if ( first === 1 && last === 0 ) { if ( first === 1 && last === 0 ) {
return true; return true;
} }
var doneName = match[0], var doneName = match[0],
parent = elem.parentNode; parent = elem.parentNode;
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0; var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) { for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
node.nodeIndex = ++count; node.nodeIndex = ++count;
} }
} }
parent.sizcache = doneName; parent.sizcache = doneName;
} }
var diff = elem.nodeIndex - last; var diff = elem.nodeIndex - last;
if ( first === 0 ) { if ( first === 0 ) {
@ -4567,7 +4567,7 @@ var Expr = Sizzle.selectors = {
TAG: function( elem, match ) { TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
}, },
CLASS: function( elem, match ) { CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ") return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1; .indexOf( match ) > -1;
@ -4633,7 +4633,7 @@ var makeArray = function( array, results ) {
results.push.apply( results, array ); results.push.apply( results, array );
return results; return results;
} }
return array; return array;
}; };
@ -4885,7 +4885,7 @@ if ( document.querySelectorAll ) {
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return; return;
} }
Sizzle = function( query, context, extra, seed ) { Sizzle = function( query, context, extra, seed ) {
context = context || document; context = context || document;
@ -4894,24 +4894,24 @@ if ( document.querySelectorAll ) {
if ( !seed && !Sizzle.isXML(context) ) { if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up // See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG") // Speed-up: Sizzle("TAG")
if ( match[1] ) { if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra ); return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS") // Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra ); return makeArray( context.getElementsByClassName( match[2] ), extra );
} }
} }
if ( context.nodeType === 9 ) { if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body") // Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it // The body element only exists once, optimize finding it
if ( query === "body" && context.body ) { if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra ); return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID") // Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) { } else if ( match && match[3] ) {
var elem = context.getElementById( match[3] ); var elem = context.getElementById( match[3] );
@ -4924,12 +4924,12 @@ if ( document.querySelectorAll ) {
if ( elem.id === match[3] ) { if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra ); return makeArray( [ elem ], extra );
} }
} else { } else {
return makeArray( [], extra ); return makeArray( [], extra );
} }
} }
try { try {
return makeArray( context.querySelectorAll(query), extra ); return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {} } catch(qsaError) {}
@ -4967,7 +4967,7 @@ if ( document.querySelectorAll ) {
} }
} }
} }
return oldSizzle(query, context, extra, seed); return oldSizzle(query, context, extra, seed);
}; };
@ -4994,7 +4994,7 @@ if ( document.querySelectorAll ) {
// This should fail with an exception // This should fail with an exception
// Gecko does not error, returns false instead // Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" ); matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) { } catch( pseudoError ) {
pseudoWorks = true; pseudoWorks = true;
} }
@ -5004,7 +5004,7 @@ if ( document.querySelectorAll ) {
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) { if ( !Sizzle.isXML( node ) ) {
try { try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr ); var ret = matches.call( node, expr );
@ -5041,7 +5041,7 @@ if ( document.querySelectorAll ) {
if ( div.getElementsByClassName("e").length === 1 ) { if ( div.getElementsByClassName("e").length === 1 ) {
return; return;
} }
Expr.order.splice(1, 0, "CLASS"); Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) { Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
@ -5092,7 +5092,7 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
if ( elem ) { if ( elem ) {
var match = false; var match = false;
elem = elem[dir]; elem = elem[dir];
while ( elem ) { while ( elem ) {
@ -5145,7 +5145,7 @@ if ( document.documentElement.contains ) {
Sizzle.isXML = function( elem ) { Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist // documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833) // (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false; return documentElement ? documentElement.nodeName !== "HTML" : false;
@ -5266,7 +5266,7 @@ jQuery.fn.extend({
closest: function( selectors, context ) { closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0]; var ret = [], i, l, cur = this[0];
// Array // Array
if ( jQuery.isArray( selectors ) ) { if ( jQuery.isArray( selectors ) ) {
var match, selector, var match, selector,
@ -6718,7 +6718,7 @@ var r20 = /%20/g,
// Document location segments // Document location segments
ajaxLocParts, ajaxLocParts,
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = ["*/"] + ["*"]; allTypes = ["*/"] + ["*"];

108
tests/jquery-1.6.4.js vendored
View File

@ -1962,11 +1962,11 @@ jQuery.fn.extend({
jQuery.removeAttr( this, name ); jQuery.removeAttr( this, name );
}); });
}, },
prop: function( name, value ) { prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop ); return jQuery.access( this, name, value, true, jQuery.prop );
}, },
removeProp: function( name ) { removeProp: function( name ) {
name = jQuery.propFix[ name ] || name; name = jQuery.propFix[ name ] || name;
return this.each(function() { return this.each(function() {
@ -2099,7 +2099,7 @@ jQuery.fn.extend({
val: function( value ) { val: function( value ) {
var hooks, ret, var hooks, ret,
elem = this[0]; elem = this[0];
if ( !arguments.length ) { if ( !arguments.length ) {
if ( elem ) { if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
@ -2110,9 +2110,9 @@ jQuery.fn.extend({
ret = elem.value; ret = elem.value;
return typeof ret === "string" ? return typeof ret === "string" ?
// handle most common string cases // handle most common string cases
ret.replace(rreturn, "") : ret.replace(rreturn, "") :
// handle cases where value is null/undef or number // handle cases where value is null/undef or number
ret == null ? "" : ret; ret == null ? "" : ret;
} }
@ -2233,15 +2233,15 @@ jQuery.extend({
height: true, height: true,
offset: true offset: true
}, },
attrFix: { attrFix: {
// Always normalize to ensure hook usage // Always normalize to ensure hook usage
tabindex: "tabIndex" tabindex: "tabIndex"
}, },
attr: function( elem, name, value, pass ) { attr: function( elem, name, value, pass ) {
var nType = elem.nodeType; var nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes // don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined; return undefined;
@ -2374,7 +2374,7 @@ jQuery.extend({
frameborder: "frameBorder", frameborder: "frameBorder",
contenteditable: "contentEditable" contenteditable: "contentEditable"
}, },
prop: function( elem, name, value ) { prop: function( elem, name, value ) {
var nType = elem.nodeType; var nType = elem.nodeType;
@ -2409,7 +2409,7 @@ jQuery.extend({
} }
} }
}, },
propHooks: { propHooks: {
tabIndex: { tabIndex: {
get: function( elem ) { get: function( elem ) {
@ -2462,7 +2462,7 @@ boolHook = {
// IE6/7 do not support getting/setting some attributes with get/setAttribute // IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !jQuery.support.getSetAttribute ) { if ( !jQuery.support.getSetAttribute ) {
// Use this for any attribute in IE6/7 // Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue // This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = { nodeHook = jQuery.valHooks.button = {
@ -2834,7 +2834,7 @@ jQuery.event = {
} }
} }
}, },
// Events that are safe to short-circuit if no handlers are attached. // Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers. // Native DOM events should not be added, they may have inline handlers.
customEvent: { customEvent: {
@ -2880,7 +2880,7 @@ jQuery.event = {
event.exclusive = exclusive; event.exclusive = exclusive;
event.namespace = namespaces.join("."); event.namespace = namespaces.join(".");
event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
// triggerHandler() and global events don't bubble or run the default action // triggerHandler() and global events don't bubble or run the default action
if ( onlyHandlers || !elem ) { if ( onlyHandlers || !elem ) {
event.preventDefault(); event.preventDefault();
@ -2971,7 +2971,7 @@ jQuery.event = {
jQuery.event.triggered = undefined; jQuery.event.triggered = undefined;
} }
} }
return event.result; return event.result;
}, },
@ -3801,7 +3801,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( context.nodeType !== 1 && context.nodeType !== 9 ) { if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return []; return [];
} }
if ( !selector || typeof selector !== "string" ) { if ( !selector || typeof selector !== "string" ) {
return results; return results;
} }
@ -3811,7 +3811,7 @@ var Sizzle = function( selector, context, results, seed ) {
contextXML = Sizzle.isXML( context ), contextXML = Sizzle.isXML( context ),
parts = [], parts = [],
soFar = selector; soFar = selector;
// Reset the position of the chunker regexp (start from head) // Reset the position of the chunker regexp (start from head)
do { do {
chunker.exec( "" ); chunker.exec( "" );
@ -3819,9 +3819,9 @@ var Sizzle = function( selector, context, results, seed ) {
if ( m ) { if ( m ) {
soFar = m[3]; soFar = m[3];
parts.push( m[1] ); parts.push( m[1] );
if ( m[2] ) { if ( m[2] ) {
extra = m[3]; extra = m[3];
break; break;
@ -3845,7 +3845,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( Expr.relative[ selector ] ) { if ( Expr.relative[ selector ] ) {
selector += parts.shift(); selector += parts.shift();
} }
set = posProcess( selector, set ); set = posProcess( selector, set );
} }
} }
@ -3974,7 +3974,7 @@ Sizzle.find = function( expr, context, isXML ) {
for ( var i = 0, l = Expr.order.length; i < l; i++ ) { for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var match, var match,
type = Expr.order[i]; type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
var left = match[1]; var left = match[1];
match.splice( 1, 1 ); match.splice( 1, 1 );
@ -4306,7 +4306,7 @@ var Expr = Sizzle.selectors = {
ATTR: function( match, curLoop, inplace, result, not, isXML ) { ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" ); var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) { if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name]; match[1] = Expr.attrMap[name];
} }
@ -4340,7 +4340,7 @@ var Expr = Sizzle.selectors = {
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true; return true;
} }
return match; return match;
}, },
@ -4350,7 +4350,7 @@ var Expr = Sizzle.selectors = {
return match; return match;
} }
}, },
filters: { filters: {
enabled: function( elem ) { enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden"; return elem.disabled === false && elem.type !== "hidden";
@ -4363,14 +4363,14 @@ var Expr = Sizzle.selectors = {
checked: function( elem ) { checked: function( elem ) {
return elem.checked === true; return elem.checked === true;
}, },
selected: function( elem ) { selected: function( elem ) {
// Accessing this property makes selected-by-default // Accessing this property makes selected-by-default
// options in Safari work properly // options in Safari work properly
if ( elem.parentNode ) { if ( elem.parentNode ) {
elem.parentNode.selectedIndex; elem.parentNode.selectedIndex;
} }
return elem.selected === true; return elem.selected === true;
}, },
@ -4392,7 +4392,7 @@ var Expr = Sizzle.selectors = {
text: function( elem ) { text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type; var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case // use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
}, },
@ -4508,21 +4508,21 @@ var Expr = Sizzle.selectors = {
case "only": case "only":
case "first": case "first":
while ( (node = node.previousSibling) ) { while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
if ( type === "first" ) { if ( type === "first" ) {
return true; return true;
} }
node = elem; node = elem;
case "last": case "last":
while ( (node = node.nextSibling) ) { while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
@ -4535,22 +4535,22 @@ var Expr = Sizzle.selectors = {
if ( first === 1 && last === 0 ) { if ( first === 1 && last === 0 ) {
return true; return true;
} }
var doneName = match[0], var doneName = match[0],
parent = elem.parentNode; parent = elem.parentNode;
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0; var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) { for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
node.nodeIndex = ++count; node.nodeIndex = ++count;
} }
} }
parent.sizcache = doneName; parent.sizcache = doneName;
} }
var diff = elem.nodeIndex - last; var diff = elem.nodeIndex - last;
if ( first === 0 ) { if ( first === 0 ) {
@ -4569,7 +4569,7 @@ var Expr = Sizzle.selectors = {
TAG: function( elem, match ) { TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
}, },
CLASS: function( elem, match ) { CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ") return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1; .indexOf( match ) > -1;
@ -4635,7 +4635,7 @@ var makeArray = function( array, results ) {
results.push.apply( results, array ); results.push.apply( results, array );
return results; return results;
} }
return array; return array;
}; };
@ -4887,7 +4887,7 @@ if ( document.querySelectorAll ) {
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return; return;
} }
Sizzle = function( query, context, extra, seed ) { Sizzle = function( query, context, extra, seed ) {
context = context || document; context = context || document;
@ -4896,24 +4896,24 @@ if ( document.querySelectorAll ) {
if ( !seed && !Sizzle.isXML(context) ) { if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up // See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG") // Speed-up: Sizzle("TAG")
if ( match[1] ) { if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra ); return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS") // Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra ); return makeArray( context.getElementsByClassName( match[2] ), extra );
} }
} }
if ( context.nodeType === 9 ) { if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body") // Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it // The body element only exists once, optimize finding it
if ( query === "body" && context.body ) { if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra ); return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID") // Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) { } else if ( match && match[3] ) {
var elem = context.getElementById( match[3] ); var elem = context.getElementById( match[3] );
@ -4926,12 +4926,12 @@ if ( document.querySelectorAll ) {
if ( elem.id === match[3] ) { if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra ); return makeArray( [ elem ], extra );
} }
} else { } else {
return makeArray( [], extra ); return makeArray( [], extra );
} }
} }
try { try {
return makeArray( context.querySelectorAll(query), extra ); return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {} } catch(qsaError) {}
@ -4969,7 +4969,7 @@ if ( document.querySelectorAll ) {
} }
} }
} }
return oldSizzle(query, context, extra, seed); return oldSizzle(query, context, extra, seed);
}; };
@ -4996,7 +4996,7 @@ if ( document.querySelectorAll ) {
// This should fail with an exception // This should fail with an exception
// Gecko does not error, returns false instead // Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" ); matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) { } catch( pseudoError ) {
pseudoWorks = true; pseudoWorks = true;
} }
@ -5006,7 +5006,7 @@ if ( document.querySelectorAll ) {
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) { if ( !Sizzle.isXML( node ) ) {
try { try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr ); var ret = matches.call( node, expr );
@ -5043,7 +5043,7 @@ if ( document.querySelectorAll ) {
if ( div.getElementsByClassName("e").length === 1 ) { if ( div.getElementsByClassName("e").length === 1 ) {
return; return;
} }
Expr.order.splice(1, 0, "CLASS"); Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) { Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
@ -5094,7 +5094,7 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
if ( elem ) { if ( elem ) {
var match = false; var match = false;
elem = elem[dir]; elem = elem[dir];
while ( elem ) { while ( elem ) {
@ -5147,7 +5147,7 @@ if ( document.documentElement.contains ) {
Sizzle.isXML = function( elem ) { Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist // documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833) // (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false; return documentElement ? documentElement.nodeName !== "HTML" : false;
@ -5268,7 +5268,7 @@ jQuery.fn.extend({
closest: function( selectors, context ) { closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0]; var ret = [], i, l, cur = this[0];
// Array // Array
if ( jQuery.isArray( selectors ) ) { if ( jQuery.isArray( selectors ) ) {
var match, selector, var match, selector,
@ -6720,7 +6720,7 @@ var r20 = /%20/g,
// Document location segments // Document location segments
ajaxLocParts, ajaxLocParts,
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = ["*/"] + ["*"]; allTypes = ["*/"] + ["*"];

130
tests/jquery-1.6.js vendored
View File

@ -1893,11 +1893,11 @@ jQuery.fn.extend({
jQuery.removeAttr( this, name ); jQuery.removeAttr( this, name );
}); });
}, },
prop: function( name, value ) { prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop ); return jQuery.access( this, name, value, true, jQuery.prop );
}, },
removeProp: function( name ) { removeProp: function( name ) {
return this.each(function() { return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window) // try/catch handles cases where IE balks (such as removing a property on window)
@ -2028,7 +2028,7 @@ jQuery.fn.extend({
val: function( value ) { val: function( value ) {
var hooks, ret, var hooks, ret,
elem = this[0]; elem = this[0];
if ( !arguments.length ) { if ( !arguments.length ) {
if ( elem ) { if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
@ -2155,16 +2155,16 @@ jQuery.extend({
height: true, height: true,
offset: true offset: true
}, },
attrFix: { attrFix: {
// Always normalize to ensure hook usage // Always normalize to ensure hook usage
tabindex: "tabIndex", tabindex: "tabIndex",
readonly: "readOnly" readonly: "readOnly"
}, },
attr: function( elem, name, value, pass ) { attr: function( elem, name, value, pass ) {
var nType = elem.nodeType; var nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes // don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined; return undefined;
@ -2173,10 +2173,10 @@ jQuery.extend({
if ( pass && name in jQuery.attrFn ) { if ( pass && name in jQuery.attrFn ) {
return jQuery( elem )[ name ]( value ); return jQuery( elem )[ name ]( value );
} }
var ret, hooks, var ret, hooks,
notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// Normalize the name if needed // Normalize the name if needed
name = notxml && jQuery.attrFix[ name ] || name; name = notxml && jQuery.attrFix[ name ] || name;
@ -2223,11 +2223,11 @@ jQuery.extend({
} }
} }
}, },
removeAttr: function( elem, name ) { removeAttr: function( elem, name ) {
if ( elem.nodeType === 1 ) { if ( elem.nodeType === 1 ) {
name = jQuery.attrFix[ name ] || name; name = jQuery.attrFix[ name ] || name;
if ( jQuery.support.getSetAttribute ) { if ( jQuery.support.getSetAttribute ) {
// Use removeAttribute in browsers that support it // Use removeAttribute in browsers that support it
elem.removeAttribute( name ); elem.removeAttribute( name );
@ -2271,43 +2271,43 @@ jQuery.extend({
} }
} }
}, },
propFix: {}, propFix: {},
prop: function( elem, name, value ) { prop: function( elem, name, value ) {
var nType = elem.nodeType; var nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes // don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return undefined; return undefined;
} }
var ret, hooks, var ret, hooks,
notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// Try to normalize/fix the name // Try to normalize/fix the name
name = notxml && jQuery.propFix[ name ] || name; name = notxml && jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ]; hooks = jQuery.propHooks[ name ];
if ( value !== undefined ) { if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret; return ret;
} else { } else {
return (elem[ name ] = value); return (elem[ name ] = value);
} }
} else { } else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) { if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) {
return ret; return ret;
} else { } else {
return elem[ name ]; return elem[ name ];
} }
} }
}, },
propHooks: {} propHooks: {}
}); });
@ -2324,7 +2324,7 @@ if ( !jQuery.support.getSetAttribute ) {
usemap: "useMap", usemap: "useMap",
frameborder: "frameBorder" frameborder: "frameBorder"
}); });
// Use this for any attribute on a form in IE6/7 // Use this for any attribute on a form in IE6/7
formHook = jQuery.attrHooks.name = jQuery.attrHooks.value = jQuery.valHooks.button = { formHook = jQuery.attrHooks.name = jQuery.attrHooks.value = jQuery.valHooks.button = {
get: function( elem, name ) { get: function( elem, name ) {
@ -2698,7 +2698,7 @@ jQuery.event = {
} }
} }
}, },
// Events that are safe to short-circuit if no handlers are attached. // Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers. // Native DOM events should not be added, they may have inline handlers.
customEvent: { customEvent: {
@ -2744,7 +2744,7 @@ jQuery.event = {
event.exclusive = exclusive; event.exclusive = exclusive;
event.namespace = namespaces.join("."); event.namespace = namespaces.join(".");
event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)");
// triggerHandler() and global events don't bubble or run the default action // triggerHandler() and global events don't bubble or run the default action
if ( onlyHandlers || !elem ) { if ( onlyHandlers || !elem ) {
event.preventDefault(); event.preventDefault();
@ -2835,7 +2835,7 @@ jQuery.event = {
jQuery.event.triggered = undefined; jQuery.event.triggered = undefined;
} }
} }
return event.result; return event.result;
}, },
@ -3669,7 +3669,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( context.nodeType !== 1 && context.nodeType !== 9 ) { if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return []; return [];
} }
if ( !selector || typeof selector !== "string" ) { if ( !selector || typeof selector !== "string" ) {
return results; return results;
} }
@ -3679,7 +3679,7 @@ var Sizzle = function( selector, context, results, seed ) {
contextXML = Sizzle.isXML( context ), contextXML = Sizzle.isXML( context ),
parts = [], parts = [],
soFar = selector; soFar = selector;
// Reset the position of the chunker regexp (start from head) // Reset the position of the chunker regexp (start from head)
do { do {
chunker.exec( "" ); chunker.exec( "" );
@ -3687,9 +3687,9 @@ var Sizzle = function( selector, context, results, seed ) {
if ( m ) { if ( m ) {
soFar = m[3]; soFar = m[3];
parts.push( m[1] ); parts.push( m[1] );
if ( m[2] ) { if ( m[2] ) {
extra = m[3]; extra = m[3];
break; break;
@ -3713,7 +3713,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( Expr.relative[ selector ] ) { if ( Expr.relative[ selector ] ) {
selector += parts.shift(); selector += parts.shift();
} }
set = posProcess( selector, set ); set = posProcess( selector, set );
} }
} }
@ -3842,7 +3842,7 @@ Sizzle.find = function( expr, context, isXML ) {
for ( var i = 0, l = Expr.order.length; i < l; i++ ) { for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
var match, var match,
type = Expr.order[i]; type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
var left = match[1]; var left = match[1];
match.splice( 1, 1 ); match.splice( 1, 1 );
@ -4174,7 +4174,7 @@ var Expr = Sizzle.selectors = {
ATTR: function( match, curLoop, inplace, result, not, isXML ) { ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" ); var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) { if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name]; match[1] = Expr.attrMap[name];
} }
@ -4208,7 +4208,7 @@ var Expr = Sizzle.selectors = {
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true; return true;
} }
return match; return match;
}, },
@ -4218,7 +4218,7 @@ var Expr = Sizzle.selectors = {
return match; return match;
} }
}, },
filters: { filters: {
enabled: function( elem ) { enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden"; return elem.disabled === false && elem.type !== "hidden";
@ -4231,14 +4231,14 @@ var Expr = Sizzle.selectors = {
checked: function( elem ) { checked: function( elem ) {
return elem.checked === true; return elem.checked === true;
}, },
selected: function( elem ) { selected: function( elem ) {
// Accessing this property makes selected-by-default // Accessing this property makes selected-by-default
// options in Safari work properly // options in Safari work properly
if ( elem.parentNode ) { if ( elem.parentNode ) {
elem.parentNode.selectedIndex; elem.parentNode.selectedIndex;
} }
return elem.selected === true; return elem.selected === true;
}, },
@ -4260,7 +4260,7 @@ var Expr = Sizzle.selectors = {
text: function( elem ) { text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type; var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case // use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
}, },
@ -4375,21 +4375,21 @@ var Expr = Sizzle.selectors = {
case "only": case "only":
case "first": case "first":
while ( (node = node.previousSibling) ) { while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
if ( type === "first" ) { if ( type === "first" ) {
return true; return true;
} }
node = elem; node = elem;
case "last": case "last":
while ( (node = node.nextSibling) ) { while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
@ -4402,22 +4402,22 @@ var Expr = Sizzle.selectors = {
if ( first === 1 && last === 0 ) { if ( first === 1 && last === 0 ) {
return true; return true;
} }
var doneName = match[0], var doneName = match[0],
parent = elem.parentNode; parent = elem.parentNode;
if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
var count = 0; var count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) { for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
node.nodeIndex = ++count; node.nodeIndex = ++count;
} }
} }
parent.sizcache = doneName; parent.sizcache = doneName;
} }
var diff = elem.nodeIndex - last; var diff = elem.nodeIndex - last;
if ( first === 0 ) { if ( first === 0 ) {
@ -4436,7 +4436,7 @@ var Expr = Sizzle.selectors = {
TAG: function( elem, match ) { TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match; return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
}, },
CLASS: function( elem, match ) { CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ") return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1; .indexOf( match ) > -1;
@ -4502,7 +4502,7 @@ var makeArray = function( array, results ) {
results.push.apply( results, array ); results.push.apply( results, array );
return results; return results;
} }
return array; return array;
}; };
@ -4749,7 +4749,7 @@ if ( document.querySelectorAll ) {
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return; return;
} }
Sizzle = function( query, context, extra, seed ) { Sizzle = function( query, context, extra, seed ) {
context = context || document; context = context || document;
@ -4758,24 +4758,24 @@ if ( document.querySelectorAll ) {
if ( !seed && !Sizzle.isXML(context) ) { if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up // See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG") // Speed-up: Sizzle("TAG")
if ( match[1] ) { if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra ); return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS") // Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra ); return makeArray( context.getElementsByClassName( match[2] ), extra );
} }
} }
if ( context.nodeType === 9 ) { if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body") // Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it // The body element only exists once, optimize finding it
if ( query === "body" && context.body ) { if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra ); return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID") // Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) { } else if ( match && match[3] ) {
var elem = context.getElementById( match[3] ); var elem = context.getElementById( match[3] );
@ -4788,12 +4788,12 @@ if ( document.querySelectorAll ) {
if ( elem.id === match[3] ) { if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra ); return makeArray( [ elem ], extra );
} }
} else { } else {
return makeArray( [], extra ); return makeArray( [], extra );
} }
} }
try { try {
return makeArray( context.querySelectorAll(query), extra ); return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {} } catch(qsaError) {}
@ -4831,7 +4831,7 @@ if ( document.querySelectorAll ) {
} }
} }
} }
return oldSizzle(query, context, extra, seed); return oldSizzle(query, context, extra, seed);
}; };
@ -4858,7 +4858,7 @@ if ( document.querySelectorAll ) {
// This should fail with an exception // This should fail with an exception
// Gecko does not error, returns false instead // Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" ); matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) { } catch( pseudoError ) {
pseudoWorks = true; pseudoWorks = true;
} }
@ -4868,7 +4868,7 @@ if ( document.querySelectorAll ) {
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) { if ( !Sizzle.isXML( node ) ) {
try { try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr ); var ret = matches.call( node, expr );
@ -4905,7 +4905,7 @@ if ( document.querySelectorAll ) {
if ( div.getElementsByClassName("e").length === 1 ) { if ( div.getElementsByClassName("e").length === 1 ) {
return; return;
} }
Expr.order.splice(1, 0, "CLASS"); Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) { Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
@ -4956,7 +4956,7 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
if ( elem ) { if ( elem ) {
var match = false; var match = false;
elem = elem[dir]; elem = elem[dir];
while ( elem ) { while ( elem ) {
@ -5009,7 +5009,7 @@ if ( document.documentElement.contains ) {
Sizzle.isXML = function( elem ) { Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist // documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833) // (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false; return documentElement ? documentElement.nodeName !== "HTML" : false;
@ -5130,7 +5130,7 @@ jQuery.fn.extend({
closest: function( selectors, context ) { closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0]; var ret = [], i, l, cur = this[0];
// Array // Array
if ( jQuery.isArray( selectors ) ) { if ( jQuery.isArray( selectors ) ) {
var match, selector, var match, selector,
@ -5884,7 +5884,7 @@ jQuery.each({
function getAll( elem ) { function getAll( elem ) {
if ( "getElementsByTagName" in elem ) { if ( "getElementsByTagName" in elem ) {
return elem.getElementsByTagName( "*" ); return elem.getElementsByTagName( "*" );
} else if ( "querySelectorAll" in elem ) { } else if ( "querySelectorAll" in elem ) {
return elem.querySelectorAll( "*" ); return elem.querySelectorAll( "*" );

82
tests/jquery-1.7.1.js vendored
View File

@ -3885,7 +3885,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( context.nodeType !== 1 && context.nodeType !== 9 ) { if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return []; return [];
} }
if ( !selector || typeof selector !== "string" ) { if ( !selector || typeof selector !== "string" ) {
return results; return results;
} }
@ -3895,7 +3895,7 @@ var Sizzle = function( selector, context, results, seed ) {
contextXML = Sizzle.isXML( context ), contextXML = Sizzle.isXML( context ),
parts = [], parts = [],
soFar = selector; soFar = selector;
// Reset the position of the chunker regexp (start from head) // Reset the position of the chunker regexp (start from head)
do { do {
chunker.exec( "" ); chunker.exec( "" );
@ -3903,9 +3903,9 @@ var Sizzle = function( selector, context, results, seed ) {
if ( m ) { if ( m ) {
soFar = m[3]; soFar = m[3];
parts.push( m[1] ); parts.push( m[1] );
if ( m[2] ) { if ( m[2] ) {
extra = m[3]; extra = m[3];
break; break;
@ -3929,7 +3929,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( Expr.relative[ selector ] ) { if ( Expr.relative[ selector ] ) {
selector += parts.shift(); selector += parts.shift();
} }
set = posProcess( selector, set, seed ); set = posProcess( selector, set, seed );
} }
} }
@ -4057,7 +4057,7 @@ Sizzle.find = function( expr, context, isXML ) {
for ( i = 0, len = Expr.order.length; i < len; i++ ) { for ( i = 0, len = Expr.order.length; i < len; i++ ) {
type = Expr.order[i]; type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
left = match[1]; left = match[1];
match.splice( 1, 1 ); match.splice( 1, 1 );
@ -4429,7 +4429,7 @@ var Expr = Sizzle.selectors = {
ATTR: function( match, curLoop, inplace, result, not, isXML ) { ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" ); var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) { if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name]; match[1] = Expr.attrMap[name];
} }
@ -4463,7 +4463,7 @@ var Expr = Sizzle.selectors = {
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true; return true;
} }
return match; return match;
}, },
@ -4473,7 +4473,7 @@ var Expr = Sizzle.selectors = {
return match; return match;
} }
}, },
filters: { filters: {
enabled: function( elem ) { enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden"; return elem.disabled === false && elem.type !== "hidden";
@ -4486,14 +4486,14 @@ var Expr = Sizzle.selectors = {
checked: function( elem ) { checked: function( elem ) {
return elem.checked === true; return elem.checked === true;
}, },
selected: function( elem ) { selected: function( elem ) {
// Accessing this property makes selected-by-default // Accessing this property makes selected-by-default
// options in Safari work properly // options in Safari work properly
if ( elem.parentNode ) { if ( elem.parentNode ) {
elem.parentNode.selectedIndex; elem.parentNode.selectedIndex;
} }
return elem.selected === true; return elem.selected === true;
}, },
@ -4515,7 +4515,7 @@ var Expr = Sizzle.selectors = {
text: function( elem ) { text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type; var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case // use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
}, },
@ -4634,21 +4634,21 @@ var Expr = Sizzle.selectors = {
case "only": case "only":
case "first": case "first":
while ( (node = node.previousSibling) ) { while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
if ( type === "first" ) { if ( type === "first" ) {
return true; return true;
} }
node = elem; node = elem;
case "last": case "last":
while ( (node = node.nextSibling) ) { while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
@ -4661,22 +4661,22 @@ var Expr = Sizzle.selectors = {
if ( first === 1 && last === 0 ) { if ( first === 1 && last === 0 ) {
return true; return true;
} }
doneName = match[0]; doneName = match[0];
parent = elem.parentNode; parent = elem.parentNode;
if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
count = 0; count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) { for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
node.nodeIndex = ++count; node.nodeIndex = ++count;
} }
} }
parent[ expando ] = doneName; parent[ expando ] = doneName;
} }
diff = elem.nodeIndex - last; diff = elem.nodeIndex - last;
if ( first === 0 ) { if ( first === 0 ) {
@ -4695,7 +4695,7 @@ var Expr = Sizzle.selectors = {
TAG: function( elem, match ) { TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
}, },
CLASS: function( elem, match ) { CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ") return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1; .indexOf( match ) > -1;
@ -4765,7 +4765,7 @@ var makeArray = function( array, results ) {
results.push.apply( results, array ); results.push.apply( results, array );
return results; return results;
} }
return array; return array;
}; };
@ -4997,7 +4997,7 @@ if ( document.querySelectorAll ) {
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return; return;
} }
Sizzle = function( query, context, extra, seed ) { Sizzle = function( query, context, extra, seed ) {
context = context || document; context = context || document;
@ -5006,24 +5006,24 @@ if ( document.querySelectorAll ) {
if ( !seed && !Sizzle.isXML(context) ) { if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up // See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG") // Speed-up: Sizzle("TAG")
if ( match[1] ) { if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra ); return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS") // Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra ); return makeArray( context.getElementsByClassName( match[2] ), extra );
} }
} }
if ( context.nodeType === 9 ) { if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body") // Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it // The body element only exists once, optimize finding it
if ( query === "body" && context.body ) { if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra ); return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID") // Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) { } else if ( match && match[3] ) {
var elem = context.getElementById( match[3] ); var elem = context.getElementById( match[3] );
@ -5036,12 +5036,12 @@ if ( document.querySelectorAll ) {
if ( elem.id === match[3] ) { if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra ); return makeArray( [ elem ], extra );
} }
} else { } else {
return makeArray( [], extra ); return makeArray( [], extra );
} }
} }
try { try {
return makeArray( context.querySelectorAll(query), extra ); return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {} } catch(qsaError) {}
@ -5079,7 +5079,7 @@ if ( document.querySelectorAll ) {
} }
} }
} }
return oldSizzle(query, context, extra, seed); return oldSizzle(query, context, extra, seed);
}; };
@ -5106,7 +5106,7 @@ if ( document.querySelectorAll ) {
// This should fail with an exception // This should fail with an exception
// Gecko does not error, returns false instead // Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" ); matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) { } catch( pseudoError ) {
pseudoWorks = true; pseudoWorks = true;
} }
@ -5116,7 +5116,7 @@ if ( document.querySelectorAll ) {
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) { if ( !Sizzle.isXML( node ) ) {
try { try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr ); var ret = matches.call( node, expr );
@ -5153,7 +5153,7 @@ if ( document.querySelectorAll ) {
if ( div.getElementsByClassName("e").length === 1 ) { if ( div.getElementsByClassName("e").length === 1 ) {
return; return;
} }
Expr.order.splice(1, 0, "CLASS"); Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) { Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
@ -5204,7 +5204,7 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
if ( elem ) { if ( elem ) {
var match = false; var match = false;
elem = elem[dir]; elem = elem[dir];
while ( elem ) { while ( elem ) {
@ -5257,7 +5257,7 @@ if ( document.documentElement.contains ) {
Sizzle.isXML = function( elem ) { Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist // documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833) // (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false; return documentElement ? documentElement.nodeName !== "HTML" : false;
@ -5374,11 +5374,11 @@ jQuery.fn.extend({
}, },
is: function( selector ) { is: function( selector ) {
return !!selector && ( return !!selector && (
typeof selector === "string" ? typeof selector === "string" ?
// If this is a positional selector, check membership in the returned set // If this is a positional selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p". // so $("p:first").is("p:last") won't return true for a doc with two "p".
POS.test( selector ) ? POS.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 : jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 : jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 ); this.filter( selector ).length > 0 );
@ -5386,7 +5386,7 @@ jQuery.fn.extend({
closest: function( selectors, context ) { closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0]; var ret = [], i, l, cur = this[0];
// Array (deprecated as of jQuery 1.7) // Array (deprecated as of jQuery 1.7)
if ( jQuery.isArray( selectors ) ) { if ( jQuery.isArray( selectors ) ) {
var level = 1; var level = 1;

View File

@ -3645,7 +3645,7 @@ if ( !jQuery.support.submitBubbles ) {
}); });
// return undefined since we don't need an event listener // return undefined since we don't need an event listener
}, },
postDispatch: function( event ) { postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree // If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) { if ( event._submit_bubble ) {

82
tests/jquery-1.7.js vendored
View File

@ -3947,7 +3947,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( context.nodeType !== 1 && context.nodeType !== 9 ) { if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return []; return [];
} }
if ( !selector || typeof selector !== "string" ) { if ( !selector || typeof selector !== "string" ) {
return results; return results;
} }
@ -3957,7 +3957,7 @@ var Sizzle = function( selector, context, results, seed ) {
contextXML = Sizzle.isXML( context ), contextXML = Sizzle.isXML( context ),
parts = [], parts = [],
soFar = selector; soFar = selector;
// Reset the position of the chunker regexp (start from head) // Reset the position of the chunker regexp (start from head)
do { do {
chunker.exec( "" ); chunker.exec( "" );
@ -3965,9 +3965,9 @@ var Sizzle = function( selector, context, results, seed ) {
if ( m ) { if ( m ) {
soFar = m[3]; soFar = m[3];
parts.push( m[1] ); parts.push( m[1] );
if ( m[2] ) { if ( m[2] ) {
extra = m[3]; extra = m[3];
break; break;
@ -3991,7 +3991,7 @@ var Sizzle = function( selector, context, results, seed ) {
if ( Expr.relative[ selector ] ) { if ( Expr.relative[ selector ] ) {
selector += parts.shift(); selector += parts.shift();
} }
set = posProcess( selector, set, seed ); set = posProcess( selector, set, seed );
} }
} }
@ -4119,7 +4119,7 @@ Sizzle.find = function( expr, context, isXML ) {
for ( i = 0, len = Expr.order.length; i < len; i++ ) { for ( i = 0, len = Expr.order.length; i < len; i++ ) {
type = Expr.order[i]; type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
left = match[1]; left = match[1];
match.splice( 1, 1 ); match.splice( 1, 1 );
@ -4491,7 +4491,7 @@ var Expr = Sizzle.selectors = {
ATTR: function( match, curLoop, inplace, result, not, isXML ) { ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" ); var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) { if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name]; match[1] = Expr.attrMap[name];
} }
@ -4525,7 +4525,7 @@ var Expr = Sizzle.selectors = {
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true; return true;
} }
return match; return match;
}, },
@ -4535,7 +4535,7 @@ var Expr = Sizzle.selectors = {
return match; return match;
} }
}, },
filters: { filters: {
enabled: function( elem ) { enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden"; return elem.disabled === false && elem.type !== "hidden";
@ -4548,14 +4548,14 @@ var Expr = Sizzle.selectors = {
checked: function( elem ) { checked: function( elem ) {
return elem.checked === true; return elem.checked === true;
}, },
selected: function( elem ) { selected: function( elem ) {
// Accessing this property makes selected-by-default // Accessing this property makes selected-by-default
// options in Safari work properly // options in Safari work properly
if ( elem.parentNode ) { if ( elem.parentNode ) {
elem.parentNode.selectedIndex; elem.parentNode.selectedIndex;
} }
return elem.selected === true; return elem.selected === true;
}, },
@ -4577,7 +4577,7 @@ var Expr = Sizzle.selectors = {
text: function( elem ) { text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type; var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case // use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
}, },
@ -4696,21 +4696,21 @@ var Expr = Sizzle.selectors = {
case "only": case "only":
case "first": case "first":
while ( (node = node.previousSibling) ) { while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
if ( type === "first" ) { if ( type === "first" ) {
return true; return true;
} }
node = elem; node = elem;
case "last": case "last":
while ( (node = node.nextSibling) ) { while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
return false; return false;
} }
} }
@ -4723,22 +4723,22 @@ var Expr = Sizzle.selectors = {
if ( first === 1 && last === 0 ) { if ( first === 1 && last === 0 ) {
return true; return true;
} }
doneName = match[0]; doneName = match[0];
parent = elem.parentNode; parent = elem.parentNode;
if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
count = 0; count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) { for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) { if ( node.nodeType === 1 ) {
node.nodeIndex = ++count; node.nodeIndex = ++count;
} }
} }
parent[ expando ] = doneName; parent[ expando ] = doneName;
} }
diff = elem.nodeIndex - last; diff = elem.nodeIndex - last;
if ( first === 0 ) { if ( first === 0 ) {
@ -4757,7 +4757,7 @@ var Expr = Sizzle.selectors = {
TAG: function( elem, match ) { TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
}, },
CLASS: function( elem, match ) { CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ") return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1; .indexOf( match ) > -1;
@ -4827,7 +4827,7 @@ var makeArray = function( array, results ) {
results.push.apply( results, array ); results.push.apply( results, array );
return results; return results;
} }
return array; return array;
}; };
@ -5059,7 +5059,7 @@ if ( document.querySelectorAll ) {
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return; return;
} }
Sizzle = function( query, context, extra, seed ) { Sizzle = function( query, context, extra, seed ) {
context = context || document; context = context || document;
@ -5068,24 +5068,24 @@ if ( document.querySelectorAll ) {
if ( !seed && !Sizzle.isXML(context) ) { if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up // See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG") // Speed-up: Sizzle("TAG")
if ( match[1] ) { if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra ); return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS") // Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra ); return makeArray( context.getElementsByClassName( match[2] ), extra );
} }
} }
if ( context.nodeType === 9 ) { if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body") // Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it // The body element only exists once, optimize finding it
if ( query === "body" && context.body ) { if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra ); return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID") // Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) { } else if ( match && match[3] ) {
var elem = context.getElementById( match[3] ); var elem = context.getElementById( match[3] );
@ -5098,12 +5098,12 @@ if ( document.querySelectorAll ) {
if ( elem.id === match[3] ) { if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra ); return makeArray( [ elem ], extra );
} }
} else { } else {
return makeArray( [], extra ); return makeArray( [], extra );
} }
} }
try { try {
return makeArray( context.querySelectorAll(query), extra ); return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {} } catch(qsaError) {}
@ -5141,7 +5141,7 @@ if ( document.querySelectorAll ) {
} }
} }
} }
return oldSizzle(query, context, extra, seed); return oldSizzle(query, context, extra, seed);
}; };
@ -5168,7 +5168,7 @@ if ( document.querySelectorAll ) {
// This should fail with an exception // This should fail with an exception
// Gecko does not error, returns false instead // Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" ); matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) { } catch( pseudoError ) {
pseudoWorks = true; pseudoWorks = true;
} }
@ -5178,7 +5178,7 @@ if ( document.querySelectorAll ) {
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) { if ( !Sizzle.isXML( node ) ) {
try { try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr ); var ret = matches.call( node, expr );
@ -5215,7 +5215,7 @@ if ( document.querySelectorAll ) {
if ( div.getElementsByClassName("e").length === 1 ) { if ( div.getElementsByClassName("e").length === 1 ) {
return; return;
} }
Expr.order.splice(1, 0, "CLASS"); Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) { Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
@ -5266,7 +5266,7 @@ function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
if ( elem ) { if ( elem ) {
var match = false; var match = false;
elem = elem[dir]; elem = elem[dir];
while ( elem ) { while ( elem ) {
@ -5319,7 +5319,7 @@ if ( document.documentElement.contains ) {
Sizzle.isXML = function( elem ) { Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist // documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833) // (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false; return documentElement ? documentElement.nodeName !== "HTML" : false;
@ -5436,11 +5436,11 @@ jQuery.fn.extend({
}, },
is: function( selector ) { is: function( selector ) {
return !!selector && ( return !!selector && (
typeof selector === "string" ? typeof selector === "string" ?
// If this is a positional selector, check membership in the returned set // If this is a positional selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p". // so $("p:first").is("p:last") won't return true for a doc with two "p".
POS.test( selector ) ? POS.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 : jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 : jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 ); this.filter( selector ).length > 0 );
@ -5448,7 +5448,7 @@ jQuery.fn.extend({
closest: function( selectors, context ) { closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0]; var ret = [], i, l, cur = this[0];
// Array (deprecated as of jQuery 1.7) // Array (deprecated as of jQuery 1.7)
if ( jQuery.isArray( selectors ) ) { if ( jQuery.isArray( selectors ) ) {
var level = 1; var level = 1;

View File

@ -6322,7 +6322,7 @@ jQuery.sub = function() {
var rootjQuerySub = jQuerySub(document); var rootjQuerySub = jQuerySub(document);
return jQuerySub; return jQuerySub;
}; };
})(); })();
var curCSS, iframe, iframeDoc, var curCSS, iframe, iframeDoc,
ralpha = /alpha\([^)]*\)/i, ralpha = /alpha\([^)]*\)/i,

View File

@ -228,7 +228,7 @@ function findCenter( elem ) {
document = $( elem.ownerDocument ); document = $( elem.ownerDocument );
elem = $( elem ); elem = $( elem );
offset = elem.offset(); offset = elem.offset();
return { return {
x: offset.left + elem.outerWidth() / 2 - document.scrollLeft(), x: offset.left + elem.outerWidth() / 2 - document.scrollLeft(),
y: offset.top + elem.outerHeight() / 2 - document.scrollTop() y: offset.top + elem.outerHeight() / 2 - document.scrollTop()
@ -241,7 +241,7 @@ $.extend( $.simulate.prototype, {
options = this.options, options = this.options,
center = findCenter( target ), center = findCenter( target ),
x = Math.floor( center.x ), x = Math.floor( center.x ),
y = Math.floor( center.y ), y = Math.floor( center.y ),
dx = options.dx || 0, dx = options.dx || 0,
dy = options.dy || 0, dy = options.dy || 0,
coord = { clientX: x, clientY: y }; coord = { clientX: x, clientY: y };

View File

@ -125,7 +125,7 @@ test("#6966: Escape key closes all dialogs, not the top one", function(){
ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog is open'); ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog is open');
ok(d2.data('dialog') && d2.dialog('isOpen'), 'second dialog is open'); ok(d2.data('dialog') && d2.dialog('isOpen'), 'second dialog is open');
$( document ).simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); $( document ).simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog still open'); ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog still open');
ok(!d2.data('dialog'), 'second dialog is closed'); ok(!d2.data('dialog'), 'second dialog is closed');
@ -136,14 +136,14 @@ test("#6966: Escape key closes all dialogs, not the top one", function(){
d2.remove(); d2.remove();
d1.remove(); d1.remove();
// test with close function removing dialog triggered through the dialog // test with close function removing dialog triggered through the dialog
d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true, close: function(){ d1.remove(); }}); d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true, close: function(){ d1.remove(); }});
d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true, close: function(){ d2.remove(); }}); d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true, close: function(){ d2.remove(); }});
ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog is open'); ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog is open');
ok(d2.data('dialog') && d2.dialog('isOpen'), 'second dialog is open'); ok(d2.data('dialog') && d2.dialog('isOpen'), 'second dialog is open');
d2.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); d2.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog still open'); ok(d1.data('dialog') && d1.dialog('isOpen'), 'first dialog still open');
ok(!d2.data('dialog'), 'second dialog is closed'); ok(!d2.data('dialog'), 'second dialog is closed');

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['ar']); $.datepicker.setDefaults($.datepicker.regional['ar']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($) {
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['az']); $.datepicker.setDefaults($.datepicker.regional['az']);
}); });

View File

@ -2,10 +2,10 @@
/* Written by Kenan Konjo. */ /* Written by Kenan Konjo. */
jQuery(function($){ jQuery(function($){
$.datepicker.regional['bs'] = { $.datepicker.regional['bs'] = {
closeText: 'Zatvori', closeText: 'Zatvori',
prevText: '&#x3C;', prevText: '&#x3C;',
nextText: '&#x3E;', nextText: '&#x3E;',
currentText: 'Danas', currentText: 'Danas',
monthNames: ['Januar','Februar','Mart','April','Maj','Juni', monthNames: ['Januar','Februar','Mart','April','Maj','Juni',
'Juli','August','Septembar','Oktobar','Novembar','Decembar'], 'Juli','August','Septembar','Oktobar','Novembar','Decembar'],
monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun',
@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['bs']); $.datepicker.setDefaults($.datepicker.regional['bs']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['cy-GB']); $.datepicker.setDefaults($.datepicker.regional['cy-GB']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['el']); $.datepicker.setDefaults($.datepicker.regional['el']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['es']); $.datepicker.setDefaults($.datepicker.regional['es']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['et']); $.datepicker.setDefaults($.datepicker.regional['et']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['eu']); $.datepicker.setDefaults($.datepicker.regional['eu']);
}); });

View File

@ -37,7 +37,7 @@ jQuery(function($) {
'س', 'س',
'چ', 'چ',
'پ', 'پ',
'ج', 'ج',
'ش' 'ش'
], ],
dayNamesMin: [ dayNamesMin: [
@ -46,7 +46,7 @@ jQuery(function($) {
'س', 'س',
'چ', 'چ',
'پ', 'پ',
'ج', 'ج',
'ش' 'ش'
], ],
weekHeader: 'هف', weekHeader: 'هف',
@ -56,4 +56,4 @@ jQuery(function($) {
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['fa']); $.datepicker.setDefaults($.datepicker.regional['fa']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['fr-CH']); $.datepicker.setDefaults($.datepicker.regional['fr-CH']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['gl']); $.datepicker.setDefaults($.datepicker.regional['gl']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['hr']); $.datepicker.setDefaults($.datepicker.regional['hr']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['hy']); $.datepicker.setDefaults($.datepicker.regional['hy']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['id']); $.datepicker.setDefaults($.datepicker.regional['id']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['is']); $.datepicker.setDefaults($.datepicker.regional['is']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: true, showMonthAfterYear: true,
yearSuffix: '年'}; yearSuffix: '年'};
$.datepicker.setDefaults($.datepicker.regional['ja']); $.datepicker.setDefaults($.datepicker.regional['ja']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: true, showMonthAfterYear: true,
yearSuffix: '년'}; yearSuffix: '년'};
$.datepicker.setDefaults($.datepicker.regional['ko']); $.datepicker.setDefaults($.datepicker.regional['ko']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['lt']); $.datepicker.setDefaults($.datepicker.regional['lt']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['lv']); $.datepicker.setDefaults($.datepicker.regional['lv']);
}); });

View File

@ -3,7 +3,7 @@
jQuery(function($){ jQuery(function($){
$.datepicker.regional['ml'] = { $.datepicker.regional['ml'] = {
closeText: 'ശരി', closeText: 'ശരി',
prevText: 'മുന്നത്തെ', prevText: 'മുന്നത്തെ',
nextText: 'അടുത്തത് ', nextText: 'അടുത്തത് ',
currentText: 'ഇന്ന്', currentText: 'ഇന്ന്',
monthNames: ['ജനുവരി','ഫെബ്രുവരി','മാര്‍ച്ച്','ഏപ്രില്‍','മേയ്','ജൂണ്‍', monthNames: ['ജനുവരി','ഫെബ്രുവരി','മാര്‍ച്ച്','ഏപ്രില്‍','മേയ്','ജൂണ്‍',

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['ms']); $.datepicker.setDefaults($.datepicker.regional['ms']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional.nl); $.datepicker.setDefaults($.datepicker.regional.nl);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['pt-BR']); $.datepicker.setDefaults($.datepicker.regional['pt-BR']);
}); });

View File

@ -19,4 +19,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['pt']); $.datepicker.setDefaults($.datepicker.regional['pt']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['ru']); $.datepicker.setDefaults($.datepicker.regional['ru']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['th']); $.datepicker.setDefaults($.datepicker.regional['th']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['tj']); $.datepicker.setDefaults($.datepicker.regional['tj']);
}); });

View File

@ -20,4 +20,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['tr']); $.datepicker.setDefaults($.datepicker.regional['tr']);
}); });

View File

@ -21,4 +21,4 @@ jQuery(function($){
showMonthAfterYear: false, showMonthAfterYear: false,
yearSuffix: ''}; yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['uk']); $.datepicker.setDefaults($.datepicker.regional['uk']);
}); });

View File

@ -116,7 +116,7 @@ function Datepicker() {
$.extend(Datepicker.prototype, { $.extend(Datepicker.prototype, {
/* Class name added to elements to indicate already configured with a date picker. */ /* Class name added to elements to indicate already configured with a date picker. */
markerClassName: 'hasDatepicker', markerClassName: 'hasDatepicker',
//Keep track of the maximum number of rows displayed (see #7043) //Keep track of the maximum number of rows displayed (see #7043)
maxRows: 4, maxRows: 4,
@ -125,7 +125,7 @@ $.extend(Datepicker.prototype, {
if (this.debug) if (this.debug)
console.log.apply('', arguments); console.log.apply('', arguments);
}, },
// TODO rename to "widget" when switching to widget factory // TODO rename to "widget" when switching to widget factory
_widgetDatepicker: function() { _widgetDatepicker: function() {
return this.dpDiv; return this.dpDiv;
@ -235,7 +235,7 @@ $.extend(Datepicker.prototype, {
if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0]) if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
$.datepicker._hideDatepicker(); $.datepicker._hideDatepicker();
else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) { else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {
$.datepicker._hideDatepicker(); $.datepicker._hideDatepicker();
$.datepicker._showDatepicker(input[0]); $.datepicker._showDatepicker(input[0]);
} else } else
$.datepicker._showDatepicker(input[0]); $.datepicker._showDatepicker(input[0]);
@ -531,7 +531,7 @@ $.extend(Datepicker.prototype, {
case 9: $.datepicker._hideDatepicker(); case 9: $.datepicker._hideDatepicker();
handled = false; handled = false;
break; // hide on tab out break; // hide on tab out
case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' + case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
$.datepicker._currentClass + ')', inst.dpDiv); $.datepicker._currentClass + ')', inst.dpDiv);
if (sel[0]) if (sel[0])
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
@ -629,7 +629,7 @@ $.extend(Datepicker.prototype, {
}, },
/* Pop-up the date picker for a given input field. /* Pop-up the date picker for a given input field.
If false returned from beforeShow event handler do not show. If false returned from beforeShow event handler do not show.
@param input element - the input field attached to the date picker or @param input element - the input field attached to the date picker or
event - if triggered by focus */ event - if triggered by focus */
_showDatepicker: function(input) { _showDatepicker: function(input) {
@ -733,7 +733,7 @@ $.extend(Datepicker.prototype, {
// this breaks the change event in IE // this breaks the change event in IE
inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement) inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
inst.input.focus(); inst.input.focus();
// deffered render of the years select (to avoid flashes on Firefox) // deffered render of the years select (to avoid flashes on Firefox)
if( inst.yearshtml ){ if( inst.yearshtml ){
var origyearshtml = inst.yearshtml; var origyearshtml = inst.yearshtml;
setTimeout(function(){ setTimeout(function(){
@ -1442,7 +1442,7 @@ $.extend(Datepicker.prototype, {
$(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]); $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]);
}); });
}, },
/* Generate the HTML for the current state of the date picker. */ /* Generate the HTML for the current state of the date picker. */
_generateHTML: function(inst) { _generateHTML: function(inst) {
var today = new Date(); var today = new Date();
@ -1599,7 +1599,7 @@ $.extend(Datepicker.prototype, {
drawMonth = 0; drawMonth = 0;
drawYear++; drawYear++;
} }
calender += '</tbody></table>' + (isMultiMonth ? '</div>' + calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : ''); ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
group += calender; group += calender;
} }
@ -1663,7 +1663,7 @@ $.extend(Datepicker.prototype, {
'>' + year + '</option>'; '>' + year + '</option>';
} }
inst.yearshtml += '</select>'; inst.yearshtml += '</select>';
html += inst.yearshtml; html += inst.yearshtml;
inst.yearshtml = null; inst.yearshtml = null;
} }
@ -1774,7 +1774,7 @@ $.extend(Datepicker.prototype, {
* Bind hover events for datepicker elements. * Bind hover events for datepicker elements.
* Done via delegate so the binding only occurs once in the lifetime of the parent div. * Done via delegate so the binding only occurs once in the lifetime of the parent div.
* Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
*/ */
function bindHover(dpDiv) { function bindHover(dpDiv) {
var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a'; var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
return dpDiv.delegate(selector, 'mouseout', function() { return dpDiv.delegate(selector, 'mouseout', function() {
@ -1806,12 +1806,12 @@ function extendRemove(target, props) {
Object - settings for attaching new datepicker functionality Object - settings for attaching new datepicker functionality
@return jQuery object */ @return jQuery object */
$.fn.datepicker = function(options){ $.fn.datepicker = function(options){
/* Verify an empty collection wasn't passed - Fixes #6976 */ /* Verify an empty collection wasn't passed - Fixes #6976 */
if ( !this.length ) { if ( !this.length ) {
return this; return this;
} }
/* Initialise the date picker. */ /* Initialise the date picker. */
if (!$.datepicker.initialized) { if (!$.datepicker.initialized) {
$(document).mousedown($.datepicker._checkExternalClick). $(document).mousedown($.datepicker._checkExternalClick).

View File

@ -73,7 +73,7 @@ $.widget("ui.draggable", $.ui.mouse, {
this.handle = this._getHandle(event); this.handle = this._getHandle(event);
if (!this.handle) if (!this.handle)
return false; return false;
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
.css({ .css({
@ -157,12 +157,12 @@ $.widget("ui.draggable", $.ui.mouse, {
if ($.ui.ddmanager && !o.dropBehaviour) if ($.ui.ddmanager && !o.dropBehaviour)
$.ui.ddmanager.prepareOffsets(this, event); $.ui.ddmanager.prepareOffsets(this, event);
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event); if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
return true; return true;
}, },
@ -201,7 +201,7 @@ $.widget("ui.draggable", $.ui.mouse, {
dropped = this.dropped; dropped = this.dropped;
this.dropped = false; this.dropped = false;
} }
//if the original element is no longer in the DOM don't bother to continue (see #8269) //if the original element is no longer in the DOM don't bother to continue (see #8269)
var element = this.element[0], elementInDom = false; var element = this.element[0], elementInDom = false;
while ( element && (element = element.parentNode) ) { while ( element && (element = element.parentNode) ) {
@ -227,29 +227,29 @@ $.widget("ui.draggable", $.ui.mouse, {
return false; return false;
}, },
_mouseUp: function(event) { _mouseUp: function(event) {
//Remove frame helpers //Remove frame helpers
$("div.ui-draggable-iframeFix").each(function() { $("div.ui-draggable-iframeFix").each(function() {
this.parentNode.removeChild(this); this.parentNode.removeChild(this);
}); });
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event); if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
return $.ui.mouse.prototype._mouseUp.call(this, event); return $.ui.mouse.prototype._mouseUp.call(this, event);
}, },
cancel: function() { cancel: function() {
if(this.helper.is(".ui-draggable-dragging")) { if(this.helper.is(".ui-draggable-dragging")) {
this._mouseUp({}); this._mouseUp({});
} else { } else {
this._clear(); this._clear();
} }
return this; return this;
}, },
_getHandle: function(event) { _getHandle: function(event) {
@ -570,14 +570,14 @@ $.ui.plugin.add("draggable", "connectToSortable", {
}; };
$.each(inst.sortables, function(i) { $.each(inst.sortables, function(i) {
var innermostIntersecting = false; var innermostIntersecting = false;
var thisSortable = this; var thisSortable = this;
//Copy over some variables to allow calling the sortable's native _intersectsWith //Copy over some variables to allow calling the sortable's native _intersectsWith
this.instance.positionAbs = inst.positionAbs; this.instance.positionAbs = inst.positionAbs;
this.instance.helperProportions = inst.helperProportions; this.instance.helperProportions = inst.helperProportions;
this.instance.offset.click = inst.offset.click; this.instance.offset.click = inst.offset.click;
if(this.instance._intersectsWith(this.instance.containerCache)) { if(this.instance._intersectsWith(this.instance.containerCache)) {
innermostIntersecting = true; innermostIntersecting = true;
$.each(inst.sortables, function () { $.each(inst.sortables, function () {
@ -634,13 +634,13 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.isOver = 0; this.instance.isOver = 0;
this.instance.cancelHelperRemoval = true; this.instance.cancelHelperRemoval = true;
//Prevent reverting on this forced stop //Prevent reverting on this forced stop
this.instance.options.revert = false; this.instance.options.revert = false;
// The out event needs to be triggered independently // The out event needs to be triggered independently
this.instance._trigger('out', event, this.instance._uiHash(this.instance)); this.instance._trigger('out', event, this.instance._uiHash(this.instance));
this.instance._mouseStop(event, true); this.instance._mouseStop(event, true);
this.instance.options.helper = this.instance.options._helper; this.instance.options.helper = this.instance.options._helper;
@ -810,7 +810,7 @@ $.ui.plugin.add("draggable", "stack", {
return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
}); });
if (!group.length) { return; } if (!group.length) { return; }
var min = parseInt(group[0].style.zIndex) || 0; var min = parseInt(group[0].style.zIndex) || 0;
$(group).each(function(i) { $(group).each(function(i) {
this.style.zIndex = min + i; this.style.zIndex = min + i;

View File

@ -26,7 +26,7 @@ $.effects.effect.highlight = function( o, done ) {
} }
$.effects.save( elem, props ); $.effects.save( elem, props );
elem elem
.show() .show()
.css({ .css({

View File

@ -104,7 +104,7 @@ $.widget("ui.mouse", {
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate); .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
event.preventDefault(); event.preventDefault();
mouseHandled = true; mouseHandled = true;
return true; return true;
}, },

View File

@ -574,7 +574,7 @@ $.ui.plugin.add("resizable", "alsoResize", {
_alsoResize = function (exp, c) { _alsoResize = function (exp, c) {
$(exp).each(function() { $(exp).each(function() {
var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left']; css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
$.each(css, function (i, prop) { $.each(css, function (i, prop) {