[jQuery] Incompatibilities with IE: Selection and Range Object (not jQuery related).

[jQuery] Incompatibilities with IE: Selection and Range Object (not jQuery related).

Hi all,
I'm trying to create a plugin for jQuery that willlet you edit text in an iFrame like it was a text processor, but I need to work with ranges and selections and, while this is extremely easy with W3C compliant browsers, Adapting the work to IE is a real pain. What I need to know is the translation of this script:
<span style="font-family: courier new,monospace;">var r = window.getSelection().getRangeAt(0);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">var e = document.createElement
("p");</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">r.surroundContents(e);</span>
that changes this range:
<span style="font-family: courier new,monospace;">
foo<a>link</a></span>
into this:
<span style="font-weight: bold; font-family: courier new,monospace;">

</span><span style="font-family: courier new,monospace;">foo<a>link</a></span>
<span style="font-weight: bold; font-family: courier new,monospace;">

</span>
It seems like IE's "special" object TextRange does something similar, but it only selects text, not the HTML tags that conform the document.
Any ideas? Thanks in advance.
Abel.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/