Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] textrange.findString(value) when value contains line breaks


  • From: latechjavascript at alex.cloudband.com (Alex Robinson)
  • Subject: [Javascript] textrange.findString(value) when value contains line breaks
  • Date: Wed Jun 22 19:08:10 2005

I want to be able to do a regexp replace over text that represents a 
bunch of nodes, but not necessarily all the children of the to zap 
all that.

Now the replace is trivial - unfortunately, in IE in any case, the 
selection is lost and the cursor is moved to the end of the 
texteditor.

I see that the textrange object has a method findString() which in 
conjunction with select() potentially enables the selection of a 
stored range of text.

Unfortunately, findString() doesn't find the string if the string 
contains line breaks. Which is a bit of a stumbling block.

I suppose that I could split the original textrange.text into chunks 
and loop through those chunks and build up the new text range to 
select but it seems a) insanely laborious and b) like I must be 
making a mistake and overlooking something more obvious.




By the way, if anyone can point me to a masterful overview of 
execCommand - that is, an overview of how badly thought out it was, 
and what quirks the various browsers that support it have - I'd be 
most grateful.