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

L. David Baron dbaron at dbaron.org
Fri Apr 30 12:12:09 PDT 2010

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

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


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

More information about the whatwg mailing list