Hi, all!
I've found a case of $(document).ready(fn) prematurely calling fn in IE(6
and 7).
It seems that the issue will occur when innerHTML modification is performed
before the document finish loading.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery domReady premature execution</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function() {
   alert($('#div2').size()); //expected to alert 1
});
</script>
</head>

<body>
<div id="div1">div1</div>
<script type="text/javascript">
var d = document.getElementById('div1');
d.innerHTML = d.innerHTML; //innerHTML modification before page loads
</script>

<div id="div2">div2</div>
</body>

</html>

Run the page in IE, refresh and again. It will alert 0 in most times.
Firefox and Opera don't have this problem. Safari is not tested yet.
I'll submit it as a ticket after more testing.
--
Arrix
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to