Thoughts on web development and technologies by Peter Gasston

Tracking down :default and command

The next milestone build of my favourite browser, Firefox, has been released today. Codenamed Gran Paradiso, the biggest changes have been made to the graphics layer, which is now Cairo. I’ve played around with it a little today, and it seems significantly faster at painting a page than its predecessor.

I took a look at the Mozilla Developer Centre page to see a fuller list of new features, and noticed that it now supports the CSS :default pseudo-class. This was a surprise to me, as I’d never heard of it! The information in the W3C recommendation document is very vague:

The :default selector applies to the one or more UI elements that are the default among a set of similar elements. Typically applies to context menu items, buttons and select lists/menus.

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.

And its entry in the WHATWG Web Controls 1.0 draft is equally mystifying to me:

This pseudo-class matches elements that have their STATE_GROUP_DEFAULT state set to STATE_DEFAULT_DEFAULT.

A dig through the Web Applications draft revealed that it is only(?) applicable to an attribute of the proposed new <command> element. What does that do? Glad you asked:

The most direct way to represent a command is by using the command element. A command element defines a command if it does not have a command attribute.

Well that’s as clear as opacity: 1; (coders joke, ha ha). From what little sense I can make of it, it’s a new non-displayed form element used for providing hooks to applications. In other words, I spent half an hour tracking down details of a new pseudo-class which is only of use on an element I can’t see myself using any time in the near future. Still, if web applications are your thing, I’m sure it’s very exciting.

1 comment on
“Tracking down :default and command”

  1. Ian Hickson [February 9th, 2007, 1:07 am; Permalink]

    :default and are unrelated.

    :default is a way to select the default button in a form. It doesn’t really apply to HTML, it was mostly an XForms thing. It might be used for more things in future in HTML5: http://www.whatwg.org/specs/web-forms/current-work/#relation

    is part of the context menu and toolbar features in HTML5. It will become a way to centrally disable all menu items and buttons that do a particular feature. It isn’t fully specced yet. As you say, it’s mostly for Web apps.

    Finally, ignore the Web Controls draft, it’s just a bunch of notes for now. :-)

    HTH, —Ian

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Search