Sending page as XML lets offsetWIdth return 0

W

webEater

When use text/html as header for my page the method
element.offsetWIdth/Height work as usually and return the real
width/height of an element, but when I use XML as type (which is
necessary in modern browsers to use strict XHTML) the function returns
just 0.

Can somebody help me, it's very important. The prototype function
Element.getDimensions() doesn't work in strict mode.

Greetz
Andi
 
A

ASM

webEater a écrit :
When use text/html as header for my page the method
element.offsetWIdth/Height work as usually and return the real
width/height of an element, but when I use XML as type (which is
necessary in modern browsers to use strict XHTML) the function returns
just 0.

Can somebody help me, it's very important. The prototype function
Element.getDimensions() doesn't work in strict mode.

Don't know this bidule.

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

and see different compatibilities about sizes and browsers
 
M

Martin Honnen

webEater said:
When use text/html as header for my page the method
element.offsetWIdth/Height work as usually and return the real
width/height of an element, but when I use XML as type (which is
necessary in modern browsers to use strict XHTML) the function returns
just 0.

I don't understand what you are trying to say. offsetWidth and
offsetHeight are properties and not functions. If you want to send XHTML
as application/xhtml+xml (to browsers that support that like Mozilla or
Opera) then offsetWidth and offsetHeight are still properties and not
functions. And in a simple example it is not 0 that is returned but
rather values greater than null
<http://home.arcor.de/martin.honnen/javascript/2006/11/test2006110101.xhtml>
at least here for me with Mozilla and with Opera 9.
But you can send XHTML 1.0 as text/html and have it rendered in
standards compliant mode:
<http://home.arcor.de/martin.honnen/javascript/2006/11/test2006110102.html>

Unless you want to use mixed namespace documents like XHTML with MathML
and/or SVG there is not need to use XHTML. Stick with HTML 4.01 sent as
text/html.
The prototype function
Element.getDimensions() doesn't work in strict mode.

I don't think the author of that stuff reads comp.lang.javascript.
 

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

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top