- From: Nathan Vander Wilt <nate-lists@calftrail.com>
- Date: Fri, 5 Apr 2013 16:48:01 -0700
- To: public-webapps@w3.org
- Cc: ayg@aryeh.name
Received on Friday, 5 April 2013 23:49:15 UTC
The comments on https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#dom-selection-addrange say "Chrome 15 dev seems to ignore addRange() if there's already a range." In case it's helpful, I wanted to note that this isn't quite the case. The WebKit implementation is here: http://trac.webkit.org/browser/trunk/Source/WebCore/page/DOMSelection.cpp#L385 What that code does, if the selection has not already been cleared via e.g. `.removeAllRanges()`, is set the selection to the *intersection* of the old selection and range being "added". Why? I have no idea. Union or extension I could see; intersection just seems bizarre. Hopefully this information is useful, though — even if it seems really hard to reconcile spec-wise with other implementations. If WebKit/Blink can't be fixed, maybe the behaviour of `addRange(range)` is simply "undefined" if `rangeCount` is 1… regards, -natevw
Received on Friday, 5 April 2013 23:49:15 UTC