[whatwg] Should :default apply to checkboxes, radios, and options?

L. David Baron dbaron at dbaron.org
Fri Apr 30 13:44:14 PDT 2010


On Friday 2010-04-30 13:43 -0700, L. David Baron wrote:
> On Friday 2010-04-30 13:05 -0700, Tab Atkins Jr. wrote:
> > On Fri, Apr 30, 2010 at 12:12 PM, L. David Baron <dbaron at dbaron.org> wrote:
> > > For a long time, Gecko has implemented the behavior that the
> > > :default pseudo-class matches checkboxes, radios, and options that
> > > are selected by default (i.e., anything that matches :checked by
> > > default).  I think supporting it for option elements is explicitly
> > > stated in the spec where :default was introduced:
> > >  # One example is the default submit button among a set of buttons.
> > >  # Another example is the default option from a popup menu.
> > >  # Multiple elements in a select-many group could have multiple
> > >  # :default elements, like a selection of pizza toppings for
> > >  # example.
> > >    -- http://www.w3.org/TR/css3-ui/#pseudo-default
> > > and I think supporting it for radios and checkboxes logically
> > > follows from that.
> > >
> > > However, the HTML5 spec says that :default should not apply in these
> > > cases:
> > > http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#selector-default
> > >
> > > I don't feel particularly strongly about this one, but it seems like
> > > the original intent of :default was to match both things that are
> > > the "default button" and things that are "selected by default".
> > >
> > > Was this difference with existing implementation behavior
> > > intentional?
> > 
> > By "selected by default", do you mean things that had @checked or
> > @selected on page load?
> 
> Not quite... just things that have @checked or @selected in the
> markup.

Er, markup wasn't the right word.

Just things that have @checked or @selected.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/



More information about the whatwg mailing list