Definition/Standard for DOM node property offsetParent

Discussion in 'Javascript' started by Patient Guy, Nov 20, 2008.

  1. Patient Guy

    Patient Guy Guest

    Can anyone point to THE definition or THE standard for the useful DOM node
    property 'offsetParent'?

    It clearly seems de facto, and not de jure ("official"). This is
    acceptable, especially if the definition/standard comes from its
    originator. I intend to set up code to deal with exceptions in its usage.
     
    Patient Guy, Nov 20, 2008
    #1
    1. Advertising

  2. Patient Guy

    RobG Guest

    On Nov 20, 6:14 pm, Patient Guy <sevisen.adam@gmailDOTHEREcom> wrote:
    > Can anyone point to THE definition or THE standard for the useful DOM node
    > property 'offsetParent'?
    >
    > It clearly seems de facto, and not de jure ("official").  This is
    > acceptable, especially if the definition/standard comes from its
    > originator.  I intend to set up code to deal with exceptions in its usage.


    <URL: https://developer.mozilla.org/en/DOM/element.offsetParent >

    <URL: http://msdn.microsoft.com/en-us/library/ms534302(VS.85).aspx >


    --
    Rob
     
    RobG, Nov 20, 2008
    #2
    1. Advertising

  3. Patient Guy

    David Mark Guest

    On Nov 20, 3:14 am, Patient Guy <sevisen.adam@gmailDOTHEREcom> wrote:
    > Can anyone point to THE definition or THE standard for the useful DOM node
    > property 'offsetParent'?


    No such thing as it is not standard.

    >
    > It clearly seems de facto, and not de jure ("official").  This is
    > acceptable, especially if the definition/standard comes from its
    > originator.  I intend to set up code to deal with exceptions in its usage.


    None of the implementations agree on that one, so you should avoid it
    whenever possible (or confine it to cases where there is some
    agreement about what it means.) There is an ongoing effort to
    standardize this and the other offset* properties. Don't hold your
    breath.
     
    David Mark, Nov 20, 2008
    #3
  4. Martin Honnen, Nov 20, 2008
    #4
  5. Patient Guy

    dhtml Guest

    David Mark wrote:
    > On Nov 20, 3:14 am, Patient Guy <sevisen.adam@gmailDOTHEREcom> wrote:
    >> Can anyone point to THE definition or THE standard for the useful DOM node
    >> property 'offsetParent'?

    >
    > No such thing as it is not standard.
    >
    >> It clearly seems de facto, and not de jure ("official"). This is
    >> acceptable, especially if the definition/standard comes from its
    >> originator. I intend to set up code to deal with exceptions in its usage.

    >


    You're in for a long painful journey.

    > None of the implementations agree on that one, so you should avoid it
    > whenever possible (or confine it to cases where there is some
    > agreement about what it means.) There is an ongoing effort to
    > standardize this and the other offset* properties. Don't hold your
    > breath.


    Couldn't agree more.

    It seems CSSOM views has been pushed through to WD status. MSIE 8 has
    implemented offsetParent to more closely match CSSOM Views' definition.

    As a result, IE6, IE7, and IE8 all have a different implementation of
    offset*.

    Mozilla, Opera, Safari all have implementations of offsetParent that
    vary between versions.

    Mozilla subtracts border on the body element.
    Opera <= 9.2 - parent border widths are included in offsetTop.
    - body offsetTop is inherited to children's offsetTop

    Safari 2.0.4 may double offsetTop of relatively positioned offsetParent.


    --
    comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >
     
    dhtml, Nov 23, 2008
    #5
  6. Patient Guy

    David Mark Guest

    On Nov 23, 12:17 am, dhtml <> wrote:
    > David Mark wrote:
    > > On Nov 20, 3:14 am, Patient Guy <sevisen.adam@gmailDOTHEREcom> wrote:
    > >> Can anyone point to THE definition or THE standard for the useful DOM node
    > >> property 'offsetParent'?

    >
    > > No such thing as it is not standard.

    >
    > >> It clearly seems de facto, and not de jure ("official").  This is
    > >> acceptable, especially if the definition/standard comes from its
    > >> originator.  I intend to set up code to deal with exceptions in its usage.

    >
    > You're in for a long painful journey.
    >
    > > None of the implementations agree on that one, so you should avoid it
    > > whenever possible (or confine it to cases where there is some
    > > agreement about what it means.)  There is an ongoing effort to
    > > standardize this and the other offset* properties.  Don't hold your
    > > breath.

    >
    > Couldn't agree more.
    >
    > It seems CSSOM views has been pushed through to WD status. MSIE 8 has
    > implemented offsetParent to more closely match CSSOM Views' definition.
    >
    > As a result, IE6, IE7, and IE8 all have a different implementation of
    > offset*.


    LOL. Well, at least IE8 defaults to "IE7 mode." That's what I heard
    anyway (I refuse to look at it at this point.)

    >
    > Mozilla, Opera, Safari all have implementations of offsetParent that
    > vary between versions.


    Yes, and it takes a heart-stopping amount of feature testing to deal
    with it all. IIRC, most of the libraries sniff browsers for this,
    which would make for some interesting code if it were anywhere near
    comprehensive (e.g. if version xyz of agent abc, substract d and
    multiply by the minor version number.)

    >
    > Mozilla subtracts border on the body element.
    > Opera <= 9.2 - parent border widths are included in offsetTop.


    I remember that BS (not that I have to as I wrote a test for it.)
    They finally fixed it? I know they added getBoundingClientRect too
    and I am interested to see how close they came to IE's rendition.

    >               - body offsetTop is inherited to children's offsetTop


    I don't follow you there.

    >
    > Safari 2.0.4 may double offsetTop of relatively positioned offsetParent.


    Yecch. Don't think I ever stumbled into that one.

    On a related note, I recently took your advice about putting
    position:relative on the body. That context drastically simplifies
    positioning code, drag and drop, etc. and got rid of the one DIV in my
    template that couldn't be justified semantically. I always hated that
    style when writing widgets for any Web page (for obvious reasons), but
    think it is quite useful when writing scripts for documents I
    control. Heard of any backward compatibility issues with that?
     
    David Mark, Nov 23, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,468
  2. Replies:
    0
    Views:
    374
  3. Tjerk Wolterink
    Replies:
    2
    Views:
    1,438
    Dimitre Novatchev
    Aug 24, 2006
  4. Vittore Zen

    div - position - offsetParent

    Vittore Zen, Nov 4, 2004, in forum: Javascript
    Replies:
    1
    Views:
    129
    Martin Honnen
    Nov 4, 2004
  5. Replies:
    2
    Views:
    175
Loading...

Share This Page