<?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>20720</bug_id>
          
          <creation_ts>2013-01-21 05:55:53 +0000</creation_ts>
          <short_desc>Define HTMLSelectElement.remove() (without argument) to do the same as ChildNode.remove()</short_desc>
          <delta_ts>2013-09-30 18:12:35 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>PC</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>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          <blocked>23398</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ilia">killxxxvi</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>cam</cc>
    
    <cc>erik.arvidsson</cc>
    
    <cc>ian</cc>
    
    <cc>killxxxvi</cc>
    
    <cc>mike</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>syoichi</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>81619</commentid>
    <comment_count>0</comment_count>
    <who name="Ilia">killxxxvi</who>
    <bug_when>2013-01-21 05:55:53 +0000</bug_when>
    <thetext>The remove() method from Interface Element [ http://www.w3.org/TR/dom/#dom-childnode-remove ] is overwritten with The remove() method from Interface HTMLSelectElement [ http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html#ID-33404570 ] for the select nodes.
Today, I have to use something like this:
window.HTMLSelectElement &amp;&amp; function(HTMLSelectElementPrototype)
{
    var removeOption = HTMLSelectElementPrototype.remove;

    HTMLSelectElementPrototype.remove = function()
    {
        if (arguments[0] &gt;= 0) removeOption.call(this, arguments[0]);
        else this.parentNode &amp;&amp; this.parentNode.removeChild(this);
    };
}(window.HTMLSelectElement.prototype);

It would be better to change HTMLSelectElement Interface so that without arguments it used remove method like Element Interface.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81620</commentid>
    <comment_count>1</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2013-01-21 07:48:12 +0000</bug_when>
    <thetext>Hrm, &lt;http://www.whatwg.org/html/#the-select-element&gt; has

  void remove(long index);

so I guess we could make it work with our

  void remove();

but I&apos;m not sure if WebIDL supports that... Cameron?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81639</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-01-21 13:39:56 +0000</bug_when>
    <thetext>One option would be for HTMLSelectElement to define overloads with and without and index and explicitly say that the no-argument overload does the same thing as the canonical Element.prototype.remove.

That&apos;s how an ES implementation would have to implement it, and I think specifying it that way is simplest.  It also happens to be simple to implement, at least in Gecko.  ;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81640</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-01-21 13:59:54 +0000</bug_when>
    <thetext>Ian, care to make that change in HTML?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81906</commentid>
    <comment_count>4</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2013-01-21 22:47:00 +0000</bug_when>
    <thetext>I agree with Boris; that&apos;s the simplest solution.  (I think overloading operations with those from an inherited interface could be confusing for the reader.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81962</commentid>
    <comment_count>5</comment_count>
    <who name="Ilia">killxxxvi</who>
    <bug_when>2013-01-22 19:24:12 +0000</bug_when>
    <thetext>Hi guys! I was wondering what is the difference between selectNode.remove(optionIndex) and selectNode[optionIndex].remove()? Do we need 2 different methods for doing extactly the same thing?
Maybe this situation occurred because the method &quot;remove&quot; from HTMLSelectElement  interface was so replaceable and too few people really enjoyed them? Maybe it is time for him to retire?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81963</commentid>
    <comment_count>6</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2013-01-22 19:26:09 +0000</bug_when>
    <thetext>HTMLSelectElement.remove(i) removes the i&apos;th option element from the this element; ChildNode.remove() removes the this object from its parent, if any.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81965</commentid>
    <comment_count>7</comment_count>
    <who name="Ilia">killxxxvi</who>
    <bug_when>2013-01-22 19:40:41 +0000</bug_when>
    <thetext>HTMLSelectElement.remove(i) - removes the i&apos;th option
HTMLSelectElement[i].remove() - removes the i&apos;th option

it is 100% replaceable, am I right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81966</commentid>
    <comment_count>8</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2013-01-22 19:41:54 +0000</bug_when>
    <thetext>Sure. We can&apos;t remove select.remove(i), though, because pages use that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81967</commentid>
    <comment_count>9</comment_count>
    <who name="Ilia">killxxxvi</who>
    <bug_when>2013-01-22 19:47:02 +0000</bug_when>
    <thetext>Is a pity, it would be a little easier.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82113</commentid>
    <comment_count>10</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-01-24 23:24:08 +0000</bug_when>
    <thetext>Having remove() remove the element from its parent and remove(i) remove a child from the element is very confusing. Can&apos;t we rename ChildNode.remove()?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82130</commentid>
    <comment_count>11</comment_count>
    <who name="Syoichi Tsuyuhara">syoichi</who>
    <bug_when>2013-01-25 03:54:34 +0000</bug_when>
    <thetext>WebKit already implemented ChildNode.remove() by Erik Arvidsson, and Google Chrome 24(stable) has it now.
http://wkrev.com/129400
http://wkb.ug/73885

But I guess that web developers aren&apos;t so using ChildNode.remove()...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82138</commentid>
    <comment_count>12</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2013-01-25 13:13:49 +0000</bug_when>
    <thetext>Do you have a better name?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82166</commentid>
    <comment_count>13</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-01-25 22:36:12 +0000</bug_when>
    <thetext>unparent()
removeFromParent()
detach()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84748</commentid>
    <comment_count>14</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-03-20 18:56:01 +0000</bug_when>
    <thetext>I&apos;m kicking this over to DOM, because remove() on HTMLSelectElement is ancient and having both do basically opposite things is going to be very confusing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84774</commentid>
    <comment_count>15</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-03-21 14:46:10 +0000</bug_when>
    <thetext>It does not seem that confusing to me that on one element there is an overloaded version that removes a child via an index which is largely a legacy API anyway.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87236</commentid>
    <comment_count>16</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-05-04 06:41:24 +0000</bug_when>
    <thetext>How is a method that does two diametrically opposite things not confusing??</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93333</commentid>
    <comment_count>17</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-09-13 07:57:51 +0000</bug_when>
    <thetext>So I don&apos;t think we&apos;re going to change. Hmm.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93667</commentid>
    <comment_count>18</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2013-09-23 19:24:32 +0000</bug_when>
    <thetext>Firefox 23 ships this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93668</commentid>
    <comment_count>19</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-09-23 19:31:43 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r8192.
Check-in comment: remove() is also defined on an ancestor interface, so overload it here on &lt;select&gt;.
http://html5.org/tools/web-apps-tracker?from=8191&amp;to=8192</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>