Intent to Deprecate: Range.compareNode() and Range.expand()

86 views
Skip to first unread message

Philip Jägenstedt

unread,
Dec 20, 2014, 6:59:31 PM12/20/14
to blink-dev

Primary eng (and PM) emails

phi...@opera.com


Summary

Deprecate Range.compareNode() and Range.expand().


Motivation

These are non-standard extensions to the Range interface introduced in 2006 and 2009 respectively:

https://trac.webkit.org/changeset/48271
https://trac.webkit.org/changeset/16302

compareNode() was once in Gecko, but was removed in 1.9:
https://developer.mozilla.org/en-US/docs/Web/API/range.compareNode

expand() is a little bit like IE's TextRange.expand():

Neither is currently supported on Range by Firefox or IE, and neither has been standardized:

Compatibility Risk

Exceptions will be thrown, unlimited breakage possible in theory.


Alternative implementation suggestion for web developers

Range.compareNode() => Range.compareBoundaryPoints() is the advice given in the MDN page.


Range.expand() => Selection.modify(), which is currently non-standard but will probably end up in the spec: https://github.com/w3c/selection-api/issues/37


The interoperability here doesn't look great, so whatever changes are made will need to be tested carefully in shipping browsers, not just work per spec.


Usage information from UseCounter


These are both much lower than many removals, with 0.0006% being the highest recorded usage for Range.expand().

Entry on chromestatus.com, crbug.com, or MDN

https://developer.mozilla.org/en-US/docs/Web/API/range.compareNode

http://msdn.microsoft.com/en-us/library/ie/ms536421%28v=vs.85%29.aspx


Requesting approval to remove too?

No. While usage is low, these have been around for a while, so let the deprecation sit for a bit to see if anyone objects.

Yuta Kitamura

unread,
Dec 22, 2014, 2:24:33 AM12/22/14
to Philip Jägenstedt, blink-dev
Non-API-owner LGTM, given the low usage + support status of other browsers.

Chris Harrelson

unread,
Dec 22, 2014, 12:05:25 PM12/22/14
to Yuta Kitamura, Philip Jägenstedt, blink-dev
LGTM

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Reply all
Reply to author
Forward
0 new messages