hi all! check this one: <html> <head> <title>Range test</title> </head> <body> <div id="myText">FooBarBaz</div> <script type="text/javascript"> myText = document.getElementById(''myText'').firstChild; var range1 = document.createRange(); range1.setStart(myText, 3); range1.setEnd(myText, 6); var range2 = document.createRange(); range2.setStart(myText, 6); range2.setEnd(myText, 9); // as you can see in Firebug console we selected ''bar'' and ''baz'' console.log(''range1: '' + range1.toString() + '' range2:'' + range2.toString()); // let''s surround ''bar'' with a bold tag.... var newNode1 = document.createElement("b"); range1.surroundContents(newNode1); // after surrounding range1, range2 doesn''t anymore contain ''baz'' !!! console.log(''range1: '' + range1.toString() + '' range2:'' + range2.toString()); </script> </body> </html> On section 2.12 of the specification http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Mutation W3C states: "There are two general principles which apply to Ranges under document mutation: The first is that all Ranges in a document will remain valid after any mutation operation and the second is that, as much as possible, all Ranges will select the same portion of the document after any mutation operation." ... "as much as possible" ??? A little bit vague... I''ve found this short thread of some interest while trying to understand what they mean: http://marc2.theaimsgroup.com/?l=xerces-j-dev&m=97257406416447&w=2 Anyway, if firefox implements the specification correctly, the behaviour stated in W3C specification seems to be not very usefull! Michael Bolin on section 8.3.2 of his thesis at MIT seems to think the same, and states to have solved this problem as part of his software project: http://groups.csail.mit.edu/uid/projects/chickenfoot/mbolin-thesis.pdf (look at page 86) I can''t see anything simple to solve this... do you? --htrex; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---