"": function(checkSet, part, isXML){
var doneName = done++, checkFn = dirCheck;
- if ( !part.match(/\W/) ) {
+ if ( !/\W/.test(part) ) {
var nodeCheck = part = isXML ? part : part.toUpperCase();
checkFn = dirNodeCheck;
}
"~": function(checkSet, part, isXML){
var doneName = done++, checkFn = dirCheck;
- if ( typeof part === "string" && !part.match(/\W/) ) {
+ if ( typeof part === "string" && !/\W/.test(part) ) {
var nodeCheck = part = isXML ? part : part.toUpperCase();
checkFn = dirNodeCheck;
}
PSEUDO: function(match, curLoop, inplace, result, not){
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
- if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) {
+ if ( chunker.exec(match[3]).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
} else if ( name === "not" ) {
var not = match[3];
- for ( var i = 0, l = not.length; i < l; i++ ) {
+ for ( i = 0, l = not.length; i < l; i++ ) {
if ( not[i] === elem ) {
return false;
}
switch (type) {
case 'only':
case 'first':
- while (node = node.previousSibling) {
+ while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) return false;
}
if ( type == 'first') return true;
node = elem;
case 'last':
- while (node = node.nextSibling) {
+ while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) return false;
}
return true;
}
var makeArray = function(array, results) {
- array = Array.prototype.slice.call( array );
+ array = Array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
try {
- Array.prototype.slice.call( document.documentElement.childNodes );
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 );
// Provide a fallback method if it does not work
} catch(e){
jQuery.expr[":"] = jQuery.expr.filters;
Sizzle.selectors.filters.hidden = function(elem){
- var width = elem.offsetWidth, height = elem.offsetHeight;
- return ( width === 0 && height === 0 ) ?
+ var width = elem.offsetWidth, height = elem.offsetHeight,
+ force = /^tr$/i.test( elem.nodeName ); // ticket #4512
+ return ( width === 0 && height === 0 && !force ) ?
true :
- ( width !== 0 && height !== 0 ) ?
- false :
- !!( jQuery.curCSS(elem, "display") === "none" );
+ ( width !== 0 && height !== 0 && !force ) ?
+ false :
+ !!( jQuery.curCSS(elem, "display") === "none" );
};
Sizzle.selectors.filters.visible = function(elem){
- var width = elem.offsetWidth, height = elem.offsetHeight;
- return ( width === 0 && height === 0 ) ?
- false :
- ( width > 0 && height > 0 ) ?
- true :
- !!( jQuery.curCSS(elem, "display") !== "none" );
+ return !Sizzle.selectors.filters.hidden(elem);
};
Sizzle.selectors.filters.animated = function(elem){