[editing] Avoiding selections with no corresponding range, to simplify authoring

2012-01-11 Thread Aryeh Gregor
Anne asked me to investigate how exactly Ranges are added to Selections (bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15470). It turns out browsers mostly don't interoperate. One interesting thing I found out is that in Gecko, if no one calls addRange/removeRange/removeAllRanges,

Re: [editing] Avoiding selections with no corresponding range, to simplify authoring

2012-01-11 Thread Ryosuke Niwa
On Wed, Jan 11, 2012 at 8:41 AM, Aryeh Gregor a...@aryeh.name wrote: Anne asked me to investigate how exactly Ranges are added to Selections (bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15470). It turns out browsers mostly don't interoperate. One interesting thing I found out is

Re: [editing] Avoiding selections with no corresponding range, to simplify authoring

2012-01-11 Thread Boris Zbarsky
On 1/11/12 11:41 AM, Aryeh Gregor wrote: Also, while I'm at it, how about collapsing at (document.documentElement, 0) instead of (document, 0)? Then you have to handle the case when document.documentElement is null. And yes, this has come up before; there are scripts out there that remove

Re: [editing] Avoiding selections with no corresponding range, to simplify authoring

2012-01-11 Thread Aryeh Gregor
On Wed, Jan 11, 2012 at 12:27 PM, Ryosuke Niwa rn...@webkit.org wrote: Does gecko returns a Range at (document, 0) for getRange(0) in such cases? Okay, it looks like my testing before was off. Actually, all browsers have no range in the selection initially. But I was testing in Live DOM