This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 12665 - This definition seems slightly wrong; if you have a tree like (assume XML-style parsing) <select><optgroup><optgroup><option>foo[...] UAs give options.length = 1, not 0. Basically the algorithm is that you walk the subtree rooted at the select, include a
Summary: This definition seems slightly wrong; if you have a tree like (assume XML-sty...
Status: RESOLVED WONTFIX
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-17 09:44 UTC by contributor
Modified: 2011-08-04 05:00 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2011-05-17 09:44:44 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/
Section: http://www.whatwg.org/specs/web-apps/current-work/#concept-select-option-list

Comment:
This definition seems slightly wrong; if you have a tree like (assume
XML-style parsing) <select><optgroup><optgroup><option>foo[...] UAs give
options.length = 1, not 0.  Basically the algorithm is that you walk the
subtree rooted at the select, include all <option> elements and recurse into
<optgroup> elements but nothing else

Posted from: 2001:4c28:a030:30:219:99ff:fe0e:5501
User agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110422 Firefox/6.0a1
Comment 1 Aryeh Gregor 2011-06-24 20:08:08 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
satisfied with this response, please change the state of this bug to CLOSED. If
you have additional information and would like the Editor to reconsider, please
reopen this bug. If you would like to escalate the issue to the full HTML
Working Group, please add the TrackerRequest keyword to this bug, and suggest
title and text for the Tracker Issue; or you may create a Tracker Issue
yourself, if you are able to do so. For more details, see this document:

   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: no spec change
Rationale: Test case:

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1047

This creates a DOM like

SELECT
    OPTION
        #text: 0
    OPTGROUP label="A"
        OPTION
            #text: 1
    OPTGROUP label="B"
        OPTGROUP label="C"
            OPTION
                #text: 2
    SPAN
        OPTION
            #text: 3
    SPAN
        OPTGROUP label="D"
            OPTION
                #text: 4
    OPTGROUP label="E"
        SPAN
            OPTION
                #text: 5

and then logs the textContent of all options in select.options.

IE9 logs 0 and 1, and displays

  0
  A
    1
  B
  E

Firefox 6.0a2 logs 0-2, but displays the same as IE.  Chrome 14 dev logs 0-5, and displays

  0
  A
    1
  B
  C
    2
  E

Opera 11.11 logs 0-5 and displays

  0
  A
    1
  B
    C
      2
  E

Conclusions:

* Only Opera has meaningful support for nested optgroups.  Chrome displays it the same as if you had an extra empty optgroup, and IE/Firefox ignore the contents of the nested optgroups entirely.
* In practice, the algorithm in the spec returns exactly the option elements that currently are displayed to the user in the two largest browsers.
* IE matches the spec exactly, while all other browsers have mismatches between what the .options attribute displays and what they show to the user.

Thus the current spec seems good.  It codifies IE's behavior, which matches Firefox's visual behavior and makes more sense than Chrome's behavior.  The only way I'd see we'd want to change this is if we actually allowed nested optgroups and required behavior like Opera, but those don't serialize, so it's a nonstarter.  There's no reason to change the spec plus IE to account for things that can't actually happen in text/html.
Comment 2 Michael[tm] Smith 2011-08-04 05:00:19 UTC
mass-moved component to LC1