fix for #4512 and minor sizzle updates

This commit is contained in:
Brandon Aaron 2009-06-23 18:11:09 +00:00
parent c6b9654ea8
commit de07ebc1a0

View file

@ -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 ) ?
( 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){