jQuery informa la altura incorrecta del elemento en el iframe de Firefox
Aquí una breve prueba para demostrar mi problema. Tengo una página que carga un iframe:
<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
</head>
<body>
<iframe id="iframe" src="box.html" style="width: 100px; height: 100px"></iframe>
<script>
$('#iframe').bind('load', function () {
var div = $(this).contents().find('div');
alert(div.height());
alert(div.innerHeight());
alert(div.outerHeight());
alert(div.outerHeight(true));
});
</script>
</body>
</html>
El iframe (box.html) contiene un solo div con estilo:
<html>
<head>
<title></title>
<style>
div {
height: 50px;
width: 50px;
margin: 5px;
padding: 5px;
border: 2px solid #00f;
background-color: #f00;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
Las cuatro alertas deben devolver 50, 60, 64 y 74, respectivamente. Esto funciona como se espera en Safari y Chrome. En FF 3.5.1, todos devuelven 64. Esto es incorrecto.
¿Alguien sabe cómo puedo forzar a FF / jQuery a devolver los valores correctos?