Connecting Tech Pros Worldwide Forums | Help | Site Map

No offsetParent in Firefox?

webEater
Guest
 
Posts: n/a
#1: Dec 19 '06
In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:

....
<body>

<div><div id="hello">Hey</div></div>

<div id="debug"></div>

<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>

</body>
....

In Firefox offsetLeft and offsetTop is 0, the script above shows null
as result. Can somebody help me?

Andi

Jeremy
Guest
 
Posts: n/a
#2: Dec 19 '06

re: No offsetParent in Firefox?


webEater wrote:
Quote:
In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:
>
...
<body>
>
<div><div id="hello">Hey</div></div>
>
<div id="debug"></div>
>
<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>
>
</body>
...
>
In Firefox offsetLeft and offsetTop is 0, the script above shows null
as result. Can somebody help me?
>
Andi
>
XHTML MIME types are not ready for prime time in a lot of respects :-P
For example, there is no such thing as incremental loading of an XHTML
document served with the proper MIME type.

If you're keen on using application/xhtml+xml anyway, you might ask in
mozilla.dev.tech.javascript on news.mozilla.org - they will be far
better equipped to handle mozilla-specific javascript questions.

Also try mozilla.dev.tech.dom.

Jeremy
webEater
Guest
 
Posts: n/a
#3: Dec 19 '06

re: No offsetParent in Firefox?




On 19 Dez., 02:36, Jeremy <jer...@pinacol.comwrote:
Quote:
webEater wrote:
Quote:
In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:
>
Quote:
...
<body>
>
Quote:
<div><div id="hello">Hey</div></div>
>
Quote:
<div id="debug"></div>
>
Quote:
<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>
>
Quote:
</body>
...
>
Quote:
In Firefox offsetLeft and offsetTop is 0, the script above shows null
as result. Can somebody help me?
>
Quote:
AndiXHTML MIME types are not ready for prime time in a lot of respects :-P
For example, there is no such thing as incremental loading of an XHTML
document served with the proper MIME type.
>
If you're keen on using application/xhtml+xml anyway, you might ask in
mozilla.dev.tech.javascript on news.mozilla.org - they will be far
better equipped to handle mozilla-specific javascript questions.
>
Also try mozilla.dev.tech.dom.
>
Jeremy
Thank you, I have posted on mozilla.dev.tech.dom. Although - is there
an other way to find out the real position of an element to a parent
one?

Andi

Martin Honnen
Guest
 
Posts: n/a
#4: Dec 19 '06

re: No offsetParent in Firefox?


webEater wrote:
Quote:
In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:
>
...
<body>
>
<div><div id="hello">Hey</div></div>
>
<div id="debug"></div>
>
<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>
I am sure it is available if you wait for the page to be loaded. Mozilla
so far for XML parsing and rendering has no incremental approach that
would allow script called _during page load_ to get such values correctly.


--

Martin Honnen
http://JavaScript.FAQTs.com/
mick white
Guest
 
Posts: n/a
#5: Dec 19 '06

re: No offsetParent in Firefox?


webEater wrote:
Quote:
In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:
>
...
<body>
>
<div><div id="hello">Hey</div></div>
>
<div id="debug"></div>
>
<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>
>
</body>
<script type="text/javascript">
//<![CDATA[
onload=function(){ alert(document.getElementById('hello').offsetParen t);}
//]]>
</script>

How does that work for you?
Mick
Quote:
...
>
In Firefox offsetLeft and offsetTop is 0, the script above shows null
as result. Can somebody help me?
>
Andi
>
webEater
Guest
 
Posts: n/a
#6: Dec 21 '06

re: No offsetParent in Firefox?



mick white schrieb:
Quote:
webEater wrote:
>
Quote:
In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:

...
<body>

<div><div id="hello">Hey</div></div>

<div id="debug"></div>

<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>

</body>
>
<script type="text/javascript">
//<![CDATA[
onload=function(){ alert(document.getElementById('hello').offsetParen t);}
//]]>
</script>
>
How does that work for you?
Mick
Quote:
...

In Firefox offsetLeft and offsetTop is 0, the script above shows null
as result. Can somebody help me?

Andi
I haven't tried it out but i am sure itr works. In the mozilla dev
group they said that the Gecko engine does not builds up the dom (or
whatevery) completely until the complete page ha been loaded. After
complete loading offsetParent etc are computed, so I have to take
onload or domload..

Closed Thread