This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13910 - There can never be no active range
Summary: There can never be no active range
Status: RESOLVED WORKSFORME
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - HTML Editing APIs (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Aryeh Gregor
QA Contact: HTML Editing APIs spec bugbot
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-26 00:11 UTC by Ian 'Hixie' Hickson
Modified: 2011-10-04 18:59 UTC (History)
3 users (show)

See Also:


Attachments

Description Ian 'Hixie' Hickson 2011-08-26 00:11:41 UTC
According to DOM Range, there's always a selection; if it's empty, it is just one range with start=end.

This means there's always an active range, so the Editing spec doesn't need to say it can be null.
Comment 1 Ehsan Akhgari [:ehsan] 2011-08-26 18:23:14 UTC
What if Selection.removeAllRanges is called?
Comment 2 Aryeh Gregor 2011-08-28 15:43:41 UTC
According to DOM Range, there's always a selection, but it might have zero ranges.  getSelection().getRangeAt(0) will then throw INDEX_SIZE_ERR.  In that case, there will be no active range.  This is how browsers all behave -- the selection in a new document will have no ranges in it.  And the selection must have no ranges in it after removeAllRanges() is called, as Ehsan points out.

Is there any specific text in DOM Range that led you to think otherwise?  If so, I'll fix it.