jQuery报告Firefox iframe中的元素高度不正确

这是一个简短的测试来certificate我的问题。 我有一个加载iframe的页面:

        $('#iframe').bind('load', function () { var div = $(this).contents().find('div'); alert(div.height()); alert(div.innerHeight()); alert(div.outerHeight()); alert(div.outerHeight(true)); });    

iframe(box.html)包含一个样式的div:

     div { height: 50px; width: 50px; margin: 5px; padding: 5px; border: 2px solid #00f; background-color: #f00; }    

四个警报应分别返回50,60,64和74。 这在Safari和Chrome中正常运行。 在FF 3.5.1中,它们都返回64.这是错误的。

有谁知道我怎么能强制FF / jQuery返回正确的值?

试试这个:

 var div = $(this).contents().find("html");