<?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>18645</bug_id>
          
          <creation_ts>2012-08-21 18:43:31 +0000</creation_ts>
          <short_desc>[Shadow]: HTMLSelectElement should have an insertion point</short_desc>
          <delta_ts>2012-10-31 22:20:33 +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>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>LATER</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>
          
          <blocked>18428</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dimitri Glazkov">dglazkov</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>bugs</cc>
    
    <cc>dominicc</cc>
    
    <cc>shinyak</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>72501</commentid>
    <comment_count>0</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-21 18:43:31 +0000</bug_when>
    <thetext>The way it behaves in real world, the HTMLSelectElement should have one insertion point that selects &quot;option&quot; elements.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72527</commentid>
    <comment_count>1</comment_count>
    <who name="Shinya Kawanaka">shinyak</who>
    <bug_when>2012-08-22 04:52:14 +0000</bug_when>
    <thetext>Actually a &lt;select&gt; element will get not only the direct children &lt;option&gt; but also get non direct children.

For example, 

​&lt;select&gt;
&lt;option&gt;foo&lt;/option&gt;
&lt;p&gt;&lt;option&gt;bar&lt;/option&gt;&lt;/p&gt;
&lt;/select&gt;​​​​​​​​​​​​​​​​​​​​​​​​​​

both &apos;foo&apos; and &apos;bar&apos; will be used in this case.

It seems this description is not accurate enough. I&apos;m not sure we have enough descriptive power to explain this behavior using Shadow DOM.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72538</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-22 16:59:32 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Actually a &lt;select&gt; element will get not only the direct children &lt;option&gt; but
&gt; also get non direct children.
&gt; 
&gt; For example, 
&gt; 
&gt; ​&lt;select&gt;
&gt; &lt;option&gt;foo&lt;/option&gt;
&gt; &lt;p&gt;&lt;option&gt;bar&lt;/option&gt;&lt;/p&gt;
&gt; &lt;/select&gt;​​​​​​​​​​​​​​​​​​​​​​​​​​
&gt; 
&gt; both &apos;foo&apos; and &apos;bar&apos; will be used in this case.

Right, but in this case, the HTML parser is playing tricks on you. Look at the resulting DOM tree: you&apos;ll see that &lt;p&gt; is silently dropped. However, if still you try to create this structure imperatively, you&apos;ll see that only &lt;options&gt; that are direct children are shown:

http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Cselect%3E%0A%3Coption%3Efoo%3C%2Foption%3E%0A%3Cp%3E%3Coption%3Ebar%3C%2Foption%3E%3C%2Fp%3E%0A%3C%2Fselect%3E%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%0A%3Cscript%3E%0A%0Avar%20option%20%3D%20document.createElement(&apos;option&apos;)%3B%0Aoption.textContent%20%3D%20&apos;baz&apos;%3B%0Avar%20p%20%3D%20document.createElement(&apos;p&apos;)%3B%0Ap.appendChild(option)%3B%0Adocument.querySelector(&apos;select&apos;).appendChild(p)%3B%0A%0A%3C%2Fscript%3E</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72574</commentid>
    <comment_count>3</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2012-08-23 02:33:07 +0000</bug_when>
    <thetext>I think &lt;select&gt; should not have an insertion point. The spec should be amended to treat it along with input, etc.

The spec should ensure that:

&lt;select&gt;
    {SR}
        &lt;option&gt;Asparagus
        &lt;content&gt;
    &lt;option&gt;Banana
    &lt;option&gt;Pear

should render &quot;Asparagus&quot;, and not a select box (and definitely not a select box with Asparagus, Banana, Pear.) The reason being that the selectedIndex of Asparagus does not make sense. Asparagus is not in the data model of the select element.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72575</commentid>
    <comment_count>4</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-23 02:59:54 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; I think &lt;select&gt; should not have an insertion point. The spec should be amended
&gt; to treat it along with input, etc.
&gt; 
&gt; The spec should ensure that:
&gt; 
&gt; &lt;select&gt;
&gt;     {SR}
&gt;         &lt;option&gt;Asparagus
&gt;         &lt;content&gt;
&gt;     &lt;option&gt;Banana
&gt;     &lt;option&gt;Pear
&gt; 
&gt; should render &quot;Asparagus&quot;, and not a select box (and definitely not a select
&gt; box with Asparagus, Banana, Pear.) The reason being that the selectedIndex of
&gt; Asparagus does not make sense. Asparagus is not in the data model of the select
&gt; element.

It can&apos;t render &quot;Asparagus&quot;, since options are not rendered.

Can you explain the problem you&apos;re seeing with &lt;select&gt; having an insertion point?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72608</commentid>
    <comment_count>5</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-08-23 14:18:03 +0000</bug_when>
    <thetext>We should not add any special cases to Shadom DOM at this point. 
Once the spec is otherwise stable, there could a yet another
spec defining additions to HTML elements (if really needed).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72613</commentid>
    <comment_count>6</comment_count>
    <who name="Dominic Cooney">dominicc</who>
    <bug_when>2012-08-23 16:07:47 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; It can&apos;t render &quot;Asparagus&quot;, since options are not rendered.

That is OK.
 
&gt; Can you explain the problem you&apos;re seeing with &lt;select&gt; having an insertion
&gt; point?

On reflection I think my beef is not with whether it has an insertion point, it is the relationship between option elements in the flattened tree and the HTMLSelectElement’s data model (selectedIndex, etc.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72614</commentid>
    <comment_count>7</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-23 16:11:42 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; (In reply to comment #4)
&gt; On reflection I think my beef is not with whether it has an insertion point, it
&gt; is the relationship between option elements in the flattened tree and the
&gt; HTMLSelectElement’s data model (selectedIndex, etc.)

Ah. the data model shouldn&apos;t need to worry about the flattened tree. It only looks at the children of &lt;select&gt;. Having an insertion point inside of a &lt;select&gt; doesn&apos;t seem to influence that in any way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72615</commentid>
    <comment_count>8</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2012-08-23 16:14:30 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; We should not add any special cases to Shadom DOM at this point. 
&gt; Once the spec is otherwise stable, there could a yet another
&gt; spec defining additions to HTML elements (if really needed).

Yup. That type of spec would be an awesome improvement for http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#bindings</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>