<?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>14591</bug_id>
          
          <creation_ts>2011-10-28 19:35:39 +0000</creation_ts>
          <short_desc>Get rid of Range.detach()</short_desc>
          <delta_ts>2012-12-04 11:45:06 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>14842</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Aryeh Gregor">ayg</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bugs</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>mats</cc>
    
    <cc>mike</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>rniwa</cc>
    
    <cc>timdown</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>59141</commentid>
    <comment_count>0</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-10-28 19:35:39 +0000</bug_when>
    <thetext>It&apos;s absolutely useless, and it adds a line to every single Range attribute and method definition.  Skimming Code Search turns up no usage of Range.detach() in the first few pages (jquery/mootools omitted because they define methods by that name that occur a lot):

http://www.google.com/codesearch#search/&amp;q=lang:%5Ejavascript$%20function:%5Edetach$%20-file:(%5E%7C/)jquery.*%5C.js$%20-file:mootools%5C.js$&amp;type=cs

Are implementers willing to drop support here?  Are there sites that actually use it?  I find four crash bugs in Gecko when searching for &quot;range detach&quot;, so clearly enough people must be using it for those to get reported.  If that&apos;s too big a compat risk, can we make it a no-op?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59682</commentid>
    <comment_count>1</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2011-11-07 16:20:44 +0000</bug_when>
    <thetext>It might be worth trying this, but perhaps implementations
should first warn about deprecated method for few releases, then
make detach no-op, and the after few releases remove the method.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59683</commentid>
    <comment_count>2</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2011-11-07 16:22:47 +0000</bug_when>
    <thetext>Or, could we make detach more useful, like detaching range automatically
from selection.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60062</commentid>
    <comment_count>3</comment_count>
    <who name="Mats Palmgren">mats</who>
    <bug_when>2011-11-16 04:01:33 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; I find four crash bugs in Gecko when searching for &quot;range detach&quot;, so
&gt; clearly enough people must be using it for those to get reported.

I found 5 Gecko crash bugs involving Range.detach(), all of which
were found by fuzz testing tools, so you shouldn&apos;t take those as
an indication that detach() is used much on the web.

(In reply to comment #1)
&gt; warn about deprecated method for few releases, then
&gt; make detach no-op, and the after few releases remove the method.

This sounds like a good plan to me.

(In reply to comment #2)
&gt; Or, could we make detach more useful, like detaching range automatically
&gt; from selection.

I would like to remove detach().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60070</commentid>
    <comment_count>4</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-11-16 14:09:50 +0000</bug_when>
    <thetext>Could Mozilla or Google try just removing the method in nightlies/canaries and see if there are any complaints?  It seems very unlikely based on available evidence that any sites are actually relying on it, so making it warn/no-op/etc. seems overly complicated.  The point of nightlies is you can make changes that have a little compat risk, right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60071</commentid>
    <comment_count>5</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-11-16 14:22:02 +0000</bug_when>
    <thetext>Anne suggested I file a Gecko bug, so I did:

https://bugzilla.mozilla.org/show_bug.cgi?id=702948</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>60072</commentid>
    <comment_count>6</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2011-11-16 15:07:52 +0000</bug_when>
    <thetext>Nightly/Canary builds don&apos;t get enough testing, especially for intranet
web apps.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67283</commentid>
    <comment_count>7</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2012-05-03 11:31:24 +0000</bug_when>
    <thetext>Gecko is experimenting with making Range.detach() a no-op for Firefox 15.  Currently it&apos;s in nightlies, and I don&apos;t think we&apos;ve received any complaints of broken pages yet, but it&apos;s only been a few days.  If it gets to stable and we still have no or almost no problem reports, I think it&apos;s definitely worth speccing it as a no-op.

Removing it entirely is probably a bad idea.  I&apos;ve seen code (including in Gecko&apos;s own non-detach()-related test support code) that pointlessly calls detach() after it&apos;s done with the range and doesn&apos;t intend to use it again.  Probably this is based on the theory that any associated storage can be freed at that point or something -- although Gecko never actually did that AFAICT.

Ms2ger, Anne, are you okay with us updating the spec now to have an XXX about this?  I&apos;d wait a little longer before changing the spec to match Gecko, in case problems arise.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67287</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-05-03 13:18:41 +0000</bug_when>
    <thetext>Just make it a no-op once we know enough. Intermediate update is not necessary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79005</commentid>
    <comment_count>9</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-11-28 16:28:20 +0000</bug_when>
    <thetext>Given that it&apos;s been many Firefox releases without complaints, I removed it since Aryeh is short on time:

https://github.com/whatwg/dom/commit/5fc29db3e55d3b9b5b5ba62b12741636fd05d8ee

Review appreciated:

http://dom.spec.whatwg.org/#ranges</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79006</commentid>
    <comment_count>10</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-11-28 16:32:47 +0000</bug_when>
    <thetext>Gecko does have .detach(). It is just no-op.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79007</commentid>
    <comment_count>11</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-11-28 16:33:49 +0000</bug_when>
    <thetext>...which is what the spec says it should be doing :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79008</commentid>
    <comment_count>12</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-11-28 16:34:35 +0000</bug_when>
    <thetext>As does the spec. I meant I removed the detached flag.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79017</commentid>
    <comment_count>13</comment_count>
    <who name="Tim Down">timdown</who>
    <bug_when>2012-11-28 17:11:11 +0000</bug_when>
    <thetext>I&apos;m in favour of getting rid of detach() because its existence is confusing, but I still have some residual confusion. I had assumed that the reason for detach()&apos;s existence was because a range needs to observe the DOM in order to update itself when the DOM changes, which must have some performance implication. Was I mistaken? If not, is the process of detaching a range now handled when the range is garbage collected?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79397</commentid>
    <comment_count>14</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2012-12-04 11:45:06 +0000</bug_when>
    <thetext>Yes, in theory detaching a range avoids the need for it to be informed of DOM changes, but in practice JS relies on garbage collection for this.  The whole point of a garbage-collected language is that authors shouldn&apos;t have to manually release resources.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>