[UPHPU] debugging js in IE
Wade Preston Shearer
wadeshearer.lists at me.com
Thu Sep 17 01:12:04 MDT 2009
Here is what it was:
I was using jQuery to get the CSS height of an element, like this…
var h = parseInt($('#example').css('height));
…and then using that value later, like this…
$('#example2').css('height', h + 'px');
All browsers except IE, returned the CSS height as "292px". IE however
was returning "auto". I wonder if this is a jQuery bug/shortcoming
where it isn't able to calculate the height in IE. Anyway, running
"auto" through pareseInt leaves you with "NaN" (not a number), which
cases IE to barf when you try to set the height of #example2 to "NaNpx".
I originally coded it to get the CSS height instead of using height(),
innerHeight(), or outerHeight() because those functions were returning
inaccurate and inconsistent results. I tried them again now and at
least the results are consistent. I changed the code to…
var h = parseInt($('#example').height() - 1);
I am getting the height of a table row. height() is returning a value
of one pixel taller than the row actually is.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2431 bytes
Desc: not available
Url : http://uphpu.org/pipermail/uphpu/attachments/20090917/272253a1/attachment-0001.bin
More information about the UPHPU
mailing list