X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fselector.js;h=c6fc0255afcd4a783592c51806ca7df0c2ffc19e;hb=f57d93bf18a2d5c3b7a0b50da67cf6147aa389c3;hp=96e339d1a27593d3b7bae3a15745ba630be8a0a4;hpb=45729831b136238d6b58cd2057192fd74073dfce;p=jquery.git diff --git a/src/selector.js b/src/selector.js index 96e339d..c6fc025 100644 --- a/src/selector.js +++ b/src/selector.js @@ -332,7 +332,7 @@ var Expr = Sizzle.selectors = { "": 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; } @@ -342,7 +342,7 @@ var Expr = Sizzle.selectors = { "~": 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; } @@ -435,7 +435,7 @@ var Expr = Sizzle.selectors = { 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); @@ -977,21 +977,17 @@ jQuery.expr = Sizzle.selectors; 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){