[jQuery] .wrap when targeting a frame generates an error in IE
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:Arial;
color:windowtext;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I tested some code in IE7 today and ran into a strange
problem with the jQuery .wrap method. I have narrowed it down to this
function failing when targeting a frame like this:<o:p></o:p></span></font>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font>
<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>curContext </span></font><font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>=</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> $(</span></font><font size=2 color="#006600" face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:#006600'>'#mPreviewFrame'</span></font><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>)[</span></font><font size=2 color="#ff0a0a"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#FF0A0A'>0</span></font><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>]</span></font><font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>.</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>contentWindow</span></font><font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>.</span></font><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>document;<o:p></o:p></span></font>
<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>$(</span></font><font
size=2 color="#006600" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#006600'>'#mydiv'</span></font><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>,curContext)</span></font><font size=2 color=blue
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:blue'>.</span></font><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>wrap('</span></font><font
size=2 color=navy face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:navy'><div</span></font><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> </span></font><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'>id=</span></font><font
size=2 color=blue face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:blue'>"myNewOuterDiv"</span></font><font size=2
color=navy face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:navy'>></div></span></font><font size=2 color="#006600"
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:#006600'>');<o:p></o:p></span></font>
<p class=MsoNormal><font size=2 color="#006600" face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:#006600'><o:p> </o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>This generates an error “Invalid Argument” in IE
7, but works fine in FF. To further isolate the problem I changed the
‘curContext’ to a div on the current page and tested, and that
works fine in IE, so it appears to be specifically releated to using a frame as
the context.<o:p></o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Does anyone know another way this could be written to
achieve the same result? Is this a bug?<o:p></o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Thanks!!<o:p></o:p></span></font>
<p class=MsoNormal><font size=2 color="#006600" face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:#006600'><o:p> </o:p></span></font>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>BrookD <o:p></o:p></span></font>
</div>
</body>
</html>