It is possible that this is happening on other elements in IE. Perhaps
we could match these known problematic elements and force a check of
the display style. It would be adding the following to the current
code.
Index: src/selector.js
===================================================================
--- src/selector.js (revision 6357)
+++ src/selector.js (working copy)
@@ -977,19 +977,21 @@
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 );
+ 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 ) ?
+ var width = elem.offsetWidth, height = elem.offsetHeight,
+ force = /^tr$/i.test( elem.tagName );
+ return ( width === 0 && height === 0 && !force ) ?
false :
- ( width > 0 && height > 0 ) ?
+ ( width > 0 && height > 0 && !force ) ?
true :
!!( jQuery.curCSS(elem, "display") !== "none" );
};
--
Brandon Aaron
On Mon, May 18, 2009 at 5:20 PM, Brandon Aaron <[email protected]> wrote:
> Got to excited and spoke to soon. Using clientWidth/Height breaks 1
> unit test in IE7 and 5 in IE6... still need to investigate why.
>
> --
> Brandon Aaron
>
>
> On Mon, May 18, 2009 at 5:14 PM, Brandon Aaron <[email protected]>
> wrote:
>> On Mon, May 18, 2009 at 5:07 PM, Brandon Aaron <[email protected]>
>> wrote:
>>> Ugh... In IE8, even though the element is display: none, it has a
>>> width and height > 0. So, this still fails for IE. Not sure what other
>>> elements IE8 does this for.
>>>
>>> Thoughts anyone?
>>
>> Looks like clientWidth/Height instead of offsetWidth/Height behave
>> properly in all the browsers, including IE8. I still recommend keeping
>> the current logic in place to guard against ambiguous dimensions.
>>
>> --
>> Brandon Aaron
>>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---