diff options
author | Brandon Aaron <brandon.aaron@gmail.com> | 2009-06-23 18:11:09 +0000 |
---|---|---|
committer | Brandon Aaron <brandon.aaron@gmail.com> | 2009-06-23 18:11:09 +0000 |
commit | de07ebc1a0a656c53ebee3f95802db08bb3cd680 (patch) | |
tree | 2aafcf1852e156956eaab1b5796397005170ccf5 /src/selector.js | |
parent | c6b9654ea8524e76f49f17f1bb0f6a38ce36bca3 (diff) | |
download | jquery-de07ebc1a0a656c53ebee3f95802db08bb3cd680.tar.gz jquery-de07ebc1a0a656c53ebee3f95802db08bb3cd680.zip |
fix for #4512 and minor sizzle updates
Diffstat (limited to 'src/selector.js')
-rw-r--r-- | src/selector.js | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/selector.js b/src/selector.js index 96e339d1a..b58507d2c 100644 --- a/src/selector.js +++ b/src/selector.js @@ -551,7 +551,7 @@ var Expr = Sizzle.selectors = { } else if ( name === "not" ) { var not = match[3]; - for ( i = 0, l = not.length; i < l; i++ ) { + for ( var i = 0, l = not.length; i < l; i++ ) { if ( not[i] === elem ) { return false; } @@ -565,13 +565,13 @@ var Expr = Sizzle.selectors = { 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; @@ -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.tagName ); // 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){ |