Definition/Standard for DOM node property offsetParent

P

Patient Guy

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.
 
D

David Mark

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.
 
D

dhtml

David said:
No such thing as it is not standard.

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.
 
D

David Mark

You're in for a long painful journey.


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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top