No offsetParent in Firefox?

W

webEater

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').offsetParent);
//]]>
</script>

</body>
....

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

Andi
 
J

Jeremy

webEater said:
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').offsetParent);
//]]>
</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
 
W

webEater

webEater said:
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:

<div><div id="hello">Hey</div></div>
<div id="debug"></div>
<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParent);
//]]>
</script>
</body>
...

In Firefox offsetLeft and offsetTop is 0, the script above shows null
as result. Can somebody help me?
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
 
M

Martin Honnen

webEater said:
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').offsetParent);
//]]>
</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.
 
M

mick white

webEater said:
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').offsetParent);
//]]>
</script>

</body>

<script type="text/javascript">
//<![CDATA[
onload=function(){ alert(document.getElementById('hello').offsetParent);}
//]]>
</script>

How does that work for you?
Mick
 
W

webEater

mick said:
webEater said:
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').offsetParent);
//]]>
</script>

</body>

<script type="text/javascript">
//<![CDATA[
onload=function(){ alert(document.getElementById('hello').offsetParent);}
//]]>
</script>

How does that work for you?
Mick
...

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

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,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top