It is a feature indeed.
MDC points out to MSDN specs.
https://developer.mozilla.org/en/DOM/element.offsetWidth
http://msdn.microsoft.com/en-us/library/ms534304(VS.85).aspx

But it's a CSSOM documented feature:

http://www.w3.org/TR/cssom-view/#offset-attributes

The offsetHeight  attribute, when called on element A, must  return value
> that is the result of the following algorithm:
>

>    1. If element A does not have an associated CSS layout box return zero
> and stop this algorithm.
>
   2. Return the number of CSS pixels of the border box height of element A.
>

Quirks mode have this tested and working across multiple browsers:
http://www.quirksmode.org/dom/w3c_cssom.html#offsetParent

On the other side I've made a test case to see if this could break plugins
and code that uses animations or other ways to set width to zero. Today
jquery supports :visible to be true when offsetWidth is 0. In my example
I've used animate({width:0,height:0}) :

http://irae.pro.br/jquerytests/offsetWidth.html

IMHO, jQuery could use something like:

if(elem.offsetWidth > 0) {
    return true;
} else {
    // current way of detecting visibility
}

--Iraê


On Sat, Jan 17, 2009 at 11:55 AM, John Resig <jere...@gmail.com> wrote:

>
> > Wow, that is sweet. For years I've had to deal with offsetWidth being
> > 0 on hidden-by-parent elements, but never thought of using it as a
> > feature!
>
> Yeah, the tables have finally turned! We can use this stupid
> bug/feature to our advantage.
>
> --John
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to