I'm afraid I can't use jQuery here since I'm not working with DOM elements, but with Range and Selection objects.
The difference is that, for example, this selection: naked text <span> a span node </span> <p> part of some other node ... <p> could never be a DOM element or a jQuery element, but rather a range, documentFragment or whatever. So thanks for your help, Glen, but this time we have to work at document level. If someone comes up with a solution, it will be welcome. Abel On 2/24/07, Glen Lipka <[EMAIL PROTECTED]> wrote:
I meant the jQuery API. http://www.jquery.com/api or http://www.visualjquery.com or http://jquery.bassistance.de/api-browser/ Actually, the one you want is wrap(), I think. Unless I misunderstood. http://jquery.bassistance.de/api-browser/#wrapString Glen On 2/23/07, Abel Tamayo <[EMAIL PROTECTED]> wrote: > > Could you send me a link to that API? I've been in the MSDN > <http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_textrange.asp>site > but it's a mess: first you see a brief description of the object but no API, > then you search for it and end up in a page where the navigation menu is in > cyrilic, then you search again to find it the object seems to be integrated > in C# and C++ and the windows API but again you can't find the actual > interface... > > So yeah, I'll try with appendTo(), butI would be thankful if you cound > send me a link to the API. > > And thanks ;) > > Abel > > On 2/23/07, Glen Lipka <[EMAIL PROTECTED]> wrote: > > > > Couldn't you use the appendTo() function? > > The API reference example looks just like what you are asking. > > > > Glen > > > > > > On 2/23/07, Abel Tamayo < [EMAIL PROTECTED]> wrote: > > > > > 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: > > > > > > var r = window.getSelection().getRangeAt(0); > > > var e = document.createElement ("p"); > > > r.surroundContents(e); > > > > > > that changes this range: > > > > > > foo<a>link</a> > > > > > > into this: > > > > > > <p>foo<a>link</a> </p> > > > > > > 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 > > > [email protected] > > > http://jquery.com/discuss/ > > > > > > > > > > _______________________________________________ > > jQuery mailing list > > [email protected] > > http://jquery.com/discuss/ > > > > > > _______________________________________________ > jQuery mailing list > [email protected] > http://jquery.com/discuss/ > > _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
_______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
