Prototype getHeight safari


#1

Hi

I have a weird bug with getHeight or getDimensions().hegiht
(prototype) only on safari
if I have a html file like this

and a embedded css

#test { width:100px; height:100px; float:left; }

In Safari $(‘test’).getHeight returns 100, fine but if the css
declaration #test… is in a css file included by a
The height is 0!!

Is it something known, is there a workaround?
Thanks
Seb


#2

In Safari $(‘test’).getHeight returns 100, fine but if the css
declaration #test… is in a css file included by a
The height is 0!!

Since your height is defined in the css and not inline, it’s not an page
attribute that your javascript can read.

if you did:

thing

it would work. In this case you could do:

height = $(‘thething’).getHeight;

This is not just a Safari issue.

Thx!


#3

if you did:

thing

it would work. In this case you could do:

height = $(‘thething’).getHeight;

This is not just a Safari issue.

Thx!

Hmmm. didn’t actually know what getHeight did so I looked it up, that
function returns the offsetHeight of an element, not the height defined
by your css (thing.style.height).

you could do: $(‘thething’).style.height; instead.

http://www.quirksmode.org/viewport/compatibility.html