[whatwg] Browser inconsistencies in rendering <optgroup> and <option>

Ian Hickson ian at hixie.ch
Mon May 2 16:26:11 PDT 2011


On Tue, 4 Jan 2011, Boris Zbarsky wrote:
> On 1/4/11 7:47 PM, Ian Hickson wrote:
> > > 1)  Gecko makes optgroup and option blocks (and applies some
> > >      bold/italic/font-size styles to the optgroup, at least).
> > > 2)  Presto renders the text in the<optgroup>  (which it treats as an
> > >      inline) but doesn't render the<option>  at all.
> > > 3)  Webkit renders neither the<optgroup>  nor the<option>
> > > 4)  Trident (IE8/9) renders like Gecko as far as styling the optgroup,
> > >      except it makes the optgroup and option inlines, not blocks.
> > > 
> > > I have a hard time believing any of this matters for interop, but....
> > 
> > I think the IE behaviour is closest to what the spec says, technically,
> > though that's mostly because the spec doesn't say much of anything about
> > <option>  and<optgroup>  rendering and so they just fall back to their
> > defaults. (The spec doesn't even suggest different default font styles,
> > leaving that up to the default<select>  binding.)
> > 
> > We can change the spec here if there's a reason to do so, but as you say,
> > I'd be surprised if there were interop needs here, so the simplest
> > behaviour (nothing special) seems the best.
> 
> Well, the reason Gecko styles optgroup and option as blocks is because it uses
> CSS layout for the innards of the dropdown in the case of comboboxes and for
> the list in the case of listboxes.  And you really don't want all your options
> on one line.  ;)

That makes sense, though I think it'd be better for that to be a style 
scoped to the binding that defines the <select>, personally.


> So we need to either specify that or define some non-CSS thing about how 
> dropdowns and listboxes are actually rendered (esp. because websites 
> very much depend on the details of it!).
> 
> I would clearly prefer that the behavior be defined in terms of CSS; UAs 
> that under the hood want to ignore the styles and just do something 
> magic can still do that, of course.

The behaviour is defined in terms of CSS and a hypothetical binding 
language similar to XBL; in theory that should be sufficient for your 
needs, no?

If not, I guess we have to work out what we can get browser vendors to 
converge on. I am concerned that this might not end up being exactly what 
you need, though, which would be of no more help to you than the status 
quo, but with more complicated rules.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list