<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>27626</bug_id>
          
          <creation_ts>2014-12-16 13:07:49 +0000</creation_ts>
          <short_desc>Specify Document.caretRangeFromPoint()?</short_desc>
          <delta_ts>2014-12-18 15:59:05 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSS</product>
          <component>CSSOM View</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Philip Jägenstedt">philipj</reporter>
          <assigned_to name="Simon Pieters">zcorpan</assigned_to>
          <cc>adrianba</cc>
    
    <cc>benjamp</cc>
    
    <cc>bzbarsky</cc>
          
          <qa_contact>public-css-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>116377</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-16 13:07:49 +0000</bug_when>
    <thetext>This is a WebKit invention, and still in Blink. Usage is high enough that removal isn&apos;t trivial, but could work out if deemed necessary:
https://www.chromestatus.com/metrics/feature/timeline/popularity/387

The caretPositionFromPoint() in the spec seems to be a Gecko-only API. I&apos;m not sure which of these can be implemented in terms of the other, or if having both makes any sense.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116378</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-12-16 13:38:56 +0000</bug_when>
    <thetext>https://github.com/search?utf8=✓&amp;q=caretrangefrompoint+NOT+shouldBe+NOT+test+NOT+expected&amp;type=Code&amp;ref=searchresults

https://github.com/search?utf8=✓&amp;q=caretpositionfrompoint+NOT+shouldBe+NOT+test+NOT+expected&amp;type=Code&amp;ref=searchresults

It seems there are some uses that does not fall back to the other API, and I didn&apos;t see any obvious use that is browser sniffing (it could exist though). As far as I can tell they are redundant with each other, but possibly having both is slightly better for Web compat.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116418</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-17 13:40:18 +0000</bug_when>
    <thetext>I&apos;ve grepped the 20141115 httparchive data, finding 160 instances of caretPositionFromPoint and 219 instances of caretRangeFromPoint. There&apos;s some overlap, as these combined are only 220 unique resources.

There is only one resource which has caretPositionFromPoint but not caretRangeFromPoint:
http://www.elenasmodels.com/JavaScriptSpellCheck/include.js

That&apos;s inside livespell.test.FireFox() :(

There are 60 resources with caretRangeFromPoint but not caretPositionFromPoint. Because of a bug &lt;https://github.com/HTTPArchive/httparchive/issues/41&gt;, here are the top-level documents that requested those resources:
http://diadiemanuong.com/
http://kroogi.com/explore?locale=en
http://ldpr.ru/
http://loot.com/
http://loot.com/user/registration/
http://mmmos.com/
http://nashrenovin.ir/
http://oak.scout.com/forums
http://paleohacks.com/
http://pfc-cska.com/
http://pressaboutus.com/
http://pubslush.com/
http://rakftz.com/
https://app.careerplug.com/user/sign_in
https://edpuzzle.com/
https://fabrily.com/
http://sozi.vn/
https://topvisor.ru/
https://trueability.com/
https://www.crowdforangels.com/
https://www.healthtrioconnect.com/app/index.page?
https://www.onewire.com/
https://www.realestate.com.ng/
https://www.reverbcity.com/
https://www.upinside.com.br/
https://www.wellnessliving.com/
http://www.1stopsocial.com/
http://www.adultfax.com/
http://www.appdata.com/
http://www.areamembri.it/login
http://www.babyfrance.com/fr
http://www.comicbook.com/
http://www.deepakchopra.it/
http://www.dnngo.net/
http://www.elfwood.com/
http://www.espguitars.com/
http://www.europeanvoice.com/
http://www.fanbacked.com/
http://www.flamengorj.com.br/
http://www.getsmarter.co.za/
http://www.gradesaver.com/
http://www.klagemauer.tv/
http://www.kla.tv/
http://www.kosmas.cz/
http://www.noomii.com/
http://www.opinionstage.com/
http://www.platfor.ma/
http://www.prnob.com/
http://www.runelocus.com/
http://www.siteprice.org/
http://www.sos-lettre.fr/
http://www.upshare.co/
http://www.valueinvestorsclub.com/
http://www.webforcepro.net/
http://www.whenathome.com/
http://www.womaninreallife.com/
http://www.worldpackers.com/
http://www.yigg.de/

Most of these seem to be TinyMCE, and a few CKEditor cases. I haven&apos;t investigated what functionality is missing without caretRangeFromPoint.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116419</commentid>
    <comment_count>3</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-17 13:48:35 +0000</bug_when>
    <thetext>Here are the uses in TinyMCE and CKEditor:
https://github.com/tinymce/tinymce/search?utf8=✓&amp;q=caretRangeFromPoint
https://github.com/ckeditor/ckeditor-dev/search?utf8=✓&amp;q=caretRangeFromPoint</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116470</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-12-18 09:51:46 +0000</bug_when>
    <thetext>The page with only caretPositionFromPoint uses it after checking for &quot;firefox&quot; in navigator.userAgent, so it would start breaking in Firefox if it was removed, but it wouldn&apos;t break for Blink to support it.

TinyMCE and CKEditor feature-check for caretRangeFromPoint before using it. They don&apos;t use any other &quot;WebKit-specific&quot; code in that code-path. So it wouldn&apos;t break for other browsers to support it.

To me this suggests the best path forward is to support both. The main risk I think is that there are pages on the long tail that use other browser-specific APIs depending on whether caretRangeFromPoint or caretPositionFromPoint is supported, but it is encouraging that it appears to not be present in the httparchive data.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116473</commentid>
    <comment_count>5</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-18 10:07:14 +0000</bug_when>
    <thetext>If caretPositionFromPoint() can be trivially expressed in terms of caretRangeFromPoint() that would be a good start. Some like use counter data from Firefox for caretPositionFromPoint() would also be very nice, since if it&apos;s a lot lower than the ~0.04% we&apos;re seeing for caretRangeFromPoint() them simply removing it seems like the fastest way to converge.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>