Optimize jQuery.expr.filters.hidden

Optimize jQuery.expr.filters.hidden

Hi,

Wouldn't it make sense to alter the order of the expressions in jQuery.expr.filters.hidden to only do the expensive work ( elem.offsetWidth) after evaluating the parts that don't trigger a reflow? In the case the element is determined to be hidden by the style, it does not trigger a reflow anymore, what would be a nice behavior for a hidden element.

So instead of 

return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none");
do

return (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none") || ( elem.offsetWidth === 0 && elem.offsetHeight === 0 );
Roel