[jQuery] Bug in before, and after??

[jQuery] Bug in before, and after??

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16525" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2>I'm getting some
unexpected results using these three functions and I wondered if this was a bug.
This is what I'm trying to accomplish:</FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2><div id="leads"
class="module"></FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2>   
<div class="moduleHeader"><BR>       
<h2>Lead
Submissions</h2><BR>        <div
class="cap"></div></FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2>   
</div></FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial
size=2></div></FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2>I can code this
manually, but I thought it would be nice to use jQuery to remove some of the
redundant code. So I first tried before and after like so:</FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2>//
jquery</FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2>$('h2',
'.module').before('<div class="moduleHeader">').after('<div
class="cap"></div></div>');</FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2><!-- html code
--></FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2><h2>Lead
Submissions</h2></FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial
size=2>results:</FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2><div
class="moduleHeader"></div><h2>Lead Submissions</h2><div
class="cap"></div></FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2>(you can see that
jQuery "finished" my "incomplete" tag)</FONT></SPAN></DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=401082821-04092007><FONT face=Arial size=2>Why is it doing
this? I know it's trying to keep "valid" code, but my code IS valid...just not
with that snippet. Anyone have any comments on this?</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV align=left><SPAN style="FONT-SIZE: 14px"><B><FONT face="Century Gothic">
<DIV align=left><SPAN class=159130414-05012007><FONT face=Arial size=2><SPAN
class=159130414-05012007><FONT face=Arial
size=2>____________________________________</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=159130414-05012007><FONT face=Arial size=2><SPAN
class=159130414-05012007></SPAN></FONT></SPAN> </DIV>Andy
Matthews<BR></FONT></B></SPAN><SPAN style="FONT-SIZE: 11px"><FONT
face="Century Gothic"><SPAN
style="FONT-SIZE: 8.5pt; FONT-FAMILY: 'Century Gothic'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes">Senior
ColdFusion Developer</SPAN><BR></FONT></SPAN><SPAN style="FONT-SIZE: 11px"><FONT
face="Century Gothic"><FONT color=#808080><IMG alt="" hspace=0
src="cid:401082821@04092007-08A2" border=0><BR></FONT>Office:  877.707.5467
x747<BR>Direct:  615.627.9747<BR>Fax:
 615.467.6249</FONT></SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 11px"><FONT
face="Century Gothic">amatthews@dealerskins.com<BR><A
href="http://www.dealerskins.com/">www.dealerskins.com</A></FONT></SPAN></DIV>
<DIV> </DIV></BODY></HTML>