DOM Object Position

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

DOM Object Position

ramsrule
Hi,

I am wondering If I will be able to get the Position of a DOM element on a
Page from the DOM Tree. To get the position on the page the document must be
paginated. After Pagination is there a way to get the DOM Elements Page
Number and its Position on the Page. I am mainly interested in the
nsDOMHTMLAnchorElements Positions.

thanks
Kanth


_______________________________________________
mozilla-dom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-dom
Reply | Threaded
Open this post in threaded view
|

Re: DOM Object Position

Boris Zbarsky
kantha Kanchiraju wrote:
> I am wondering If I will be able to get the Position of a DOM element

This concept is not well-defined.

-Boris
_______________________________________________
mozilla-dom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-dom
Reply | Threaded
Open this post in threaded view
|

Re: DOM Object Position

Martin NG
I also want to know how to get the position of an DOM element. e.g, a
button, a textbox.

_______________________________________________
mozilla-dom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-dom
Reply | Threaded
Open this post in threaded view
|

Re: DOM Object Position

Boris Zbarsky
Martin NG wrote:
> I also want to know how to get the position of an DOM element. e.g, a
> button, a textbox.

Again, the concept of "position" for a "DOM element" is not well-defined.

-Boris
_______________________________________________
mozilla-dom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-dom
Reply | Threaded
Open this post in threaded view
|

Re: DOM Object Position

kravvitz
In reply to this post by ramsrule
As far as I know, the W3C's DOMs don't provide a way to do this,
however, a certain page on QuirksMode.org may interest you.

http://www.quirksmode.org/js/findpos.html

_______________________________________________
mozilla-dom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-dom
Reply | Threaded
Open this post in threaded view
|

Re: DOM Object Position

Boris Zbarsky
[hidden email] wrote:
> As far as I know, the W3C's DOMs don't provide a way to do this,
> however, a certain page on QuirksMode.org may interest you.
>
> http://www.quirksmode.org/js/findpos.html

Note that it doesn't work so well for some cases (and can't; for example <area>
elements may appear in multiple places at once on the page).

-Boris
_______________________________________________
mozilla-dom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-dom
Reply | Threaded
Open this post in threaded view
|

Re: DOM Object Position

ramsrule
In reply to this post by Boris Zbarsky
Hi,

I am using the nsIDOMNSHTMLElement to get the Offsets, Width and Height. The
Offsets which I am getting are with respect to its Offset Parent. So I went
up the Tree adding the offsets of its parent to get the actual offset.
Intially I am getting the Offsets which doesnt fall with in the Paper Size
boundaries. So I did a Print Preview and then got the offsets. this time the
offsets are better and are falling in page boundaries but the offsets are
not matching to actual element coordinates on the page.

My question is will I be able to get the right Offsets that will match the
DOM Element, By doing this? When travesring the Tree when should I stop,
should I go all the way to the top of the tree? Will I be able to get the
Offset from the Page Origin to the Element?

thanks
Kanth
"Boris Zbarsky" <[hidden email]> wrote in message
news:djnu45$[hidden email]...
> Martin NG wrote:
> > I also want to know how to get the position of an DOM element. e.g, a
> > button, a textbox.
>
> Again, the concept of "position" for a "DOM element" is not well-defined.
>
> -Boris


_______________________________________________
mozilla-dom mailing list
[hidden email]
http://mail.mozilla.org/listinfo/mozilla-dom