[w3c/selection-api] Let addRange not update existing range (#80)

If we have no range, addRange set new range to Selection, of course.
What if we have a range in Selection?
Chrome 58/Safari creates another range if exisiting range crosses newrange and ignore otherwise.
Edge 25 ignores anyway.
Firefox 51 appends the range and Selection.getRangeAt(1) returns the range.
In the spec, new range replaces existing range.

For interoperability, I suggest updating spec in the case where Selection has a range and addRange:
"If rangeCount is 1, addRange() should not update the range returned by getRangeAt(0)"
This looks Edge 25 implementation but Firefox follow at least getRangeAt(0).

This spec assures:
```javascript
s = getSelection();
r1 = new Range();
s.addRange(r1);
r2 = new Range();
s.addRange(r2);
assert(r1 == s.getRangeAt(0));
```

Put multi-range specifying later, how about unify addRange/getRange(0) behavior
(this suggestion can be extended to multi-range)?
 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/selection-api/issues/80

Received on Tuesday, 14 February 2017 08:00:02 UTC