Is this a Bug?
Is this a Bug?
When i try to reference a textarea in the parent window, for the first
time it will return 'undefined', and will return '[object
HTMLTextAreaElement]' thereafter. This happens to both Firefox 3.0.5
and IE 7.0.5730.13 under XP SP3.
Here are the two html files;
----------------------------------------------------------------------------------------------------------------------------------
parent.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Parent</title>
</head>
<body>
<div id="sign-in">
<input type="submit" value="Ignore this" />
<input type="reset" value="Ignore this" />
</div>
<div id="main">
<iframe src="child.html" frameborder="no"></iframe>
</div>
<div id="editor">
<textarea rows="10" cols="30"></textarea>
<input type="submit" value="Ignore this" />
<input type="reset" value="Ignore this" />
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$("#sign-in input[type=reset]").click(function() {
$("#sign-in").fadeOut("slow");
});
</script>
</body>
</html>
----------------------------------------------------------------------------------------------------------------------
child.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Child</title>
</head>
<body>
<div>
<input id="button" type="button" value="This should never prompt
'undifined' ">
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$.fn.test = function() {
alert(this[0]);
};
$("#button").click(function() {
$("#editor textarea",parent.document).test();
})
</script>
</body>
</html>
------------------------------------------------------------------------------------------------------------
I'm not sure if it has something to do with my settings, let me know
if you experience the same thing. Thank you.