2

Two years ago the HTML5 standard dropped the chapter "Text Selection API" which contained a specification of the Selection interface:

[Stringifies] interface Selection {
  readonly attribute Node anchorNode;
  readonly attribute long anchorOffset;
  readonly attribute Node focusNode;
  readonly attribute long focusOffset;
  readonly attribute boolean isCollapsed;
  void collapse(in Node parentNode, in long offset);
  void collapseToStart();
  void collapseToEnd();
  void selectAllChildren(in Node parentNode);
  void deleteFromDocument();
  readonly attribute long rangeCount;
  Range getRangeAt(in long index);
  void addRange(in Range range);
  void removeRange(in Range range);
  void removeAllRanges();
};

See here: http://www.w3.org/TR/2009/WD-html5-20090423/editing.html#selection

I remember encountering this interface in another standard, but I forgot which one. Could anyone please refresh my memory?

Šime Vidas
  • 182,163
  • 62
  • 281
  • 385

1 Answers1

3

It moved to WHATWG's DOM Range spec. The Range portion of that document has very recently (within the last week or so) been migrated to W3C's DOM4 spec.

This leaves the WHATWG Range spec in the position of being rather misleadlingly named. I'm not sure whether there are plans to move the Selection stuff again but I wouldn't bet against it.

Update February 2013

The Selection portion of the spec is currently found in the HTML Editing APIs spec.

Tim Down
  • 318,141
  • 75
  • 454
  • 536
  • Ah yes, that's it. Btw how can one view the list of specs inside the http://html5.org/specs/ folder? Do I really have to do a [Google search](http://www.google.com/#sclient=psy-ab&hl=en&source=hp&q=site:http%3A%2F%2Fhtml5.org%2Fspecs%2F&pbx=1&oq=site:http%3A%2F%2Fhtml5.org%2Fspecs%2F&aq=f&aqi=&aql=&gs_sm=e&gs_upl=1073l2693l0l3657l6l4l0l0l0l0l209l636l0.3.1l4l0&bav=on.2,or.r_gc.r_pw.&fp=b659e1e8b520709&biw=1492&bih=1071)? – Šime Vidas Sep 19 '11 at 13:28
  • Btw would you possibly know what the state of browser implementation for the `Selection` interface is? (which browsers implement it) – Šime Vidas Sep 19 '11 at 13:37
  • 1
    @Šime: I can't remember whether I've seen one somewhere, but I can't find one now. The best I've found is http://platform.html5.org/ – Tim Down Sep 19 '11 at 13:51
  • 1
    @Šime: Current versions of all major browsers implement the majority of the `Selection` interface, although there is some variation (`modify()` is a relatively recent addition and is not well supported, `extend()` likewise and is not supported in IE 9, `toString()` is inconsistently implemented and does not match the spec in many cases, plus probably many other issues). The spec itself has some outstanding issues. – Tim Down Sep 19 '11 at 13:55