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 25831 - Specify selection.setBaseAndExtent
Summary: Specify selection.setBaseAndExtent
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Selection API (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Ryosuke Niwa
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-20 18:33 UTC by Ben Peters
Modified: 2014-09-16 01:15 UTC (History)
2 users (show)

See Also:


Attachments

Description Ben Peters 2014-05-20 18:33:45 UTC
Selection.setBaseAndExtent is not defined in a standard, but it exists in WebKit and is used on the web. We should consider specifying it for compatibility. I was unable to find documentation, but there is a use case below.

http://stackoverflow.com/questions/985272/jquery-selecting-text-in-an-element-akin-to-highlighting-with-your-mouse
Comment 1 Ben Peters 2014-08-05 22:48:26 UTC
Proposed text, based on the text for collapse():

void setBaseAndExtent (Node baseNode, unsigned long baseOffset, Node extentNode, unsigned long extentOffset);

The method must throw an IndexSizeError exception if offset is negative or longer than node's length ([DOM4]). Otherwise, it must create a new range, set ([DOM4]) its start to (baseNode, baseOffset) and its and end to (extentNode, extentOffset), and set the context object's range to the newly-created range.