W3C home > Mailing lists > Public > www-style@w3.org > August 1999

RE: New WD: CSS3 selectors

From: Bert Bos <Bert.Bos@sophia.inria.fr>
Date: Thu, 5 Aug 1999 16:53:37 +0200 (MET DST)
To: <www-style@w3.org>
Message-ID: <14249.31604.82366.210188@www43.inria.fr>
Jelks Cabaniss writes:
 > > A new working draft was just published:
 > >
 > >     CSS3 module: W3C selectors
 > >     http://www.w3.org/TR/1999/WD-CSS3-selectors-19990803
 > It's good to see this.
 > Question: there's a caveat under the example "E.warning" that says "HTML only".
 > XML, unlike with IDs, has no "built-in" notation of *class*.  But is there any
 > real reason for CSS *excluding* recognition of class in XML, in other words --
 > providing automatic recognition of class (or CLASS) regardless of the semantics
 > of the markup language in question?

The text you quote is literally copied from the current CSS2 spec. I
believe we will eventually find a way to use ".class" with XML,
because, as you say below, it is simply very convenient.

But so far we haven't found the description we like. The idea is that
".class" represents a *concept*, not so much a specific attribute. In
HTML it is indeed called "class," but in other formats it may be a
different attribute. E.g., in the TEI format, it seems reasonable to
use "type."

But if ".class" is an abstract concept, it needs to be bound to
something concrete, via some specific syntax. There are several

1. In the XML document itself:

   a. Using XML namespaces: we define a namespace that contains a
      class-like attribute, and maybe something more, such as a
      "style" attribute. That namespace would define that you can use
      <foo x:class="bar"> under certain conditions.

   b. Using predefined XML attributes. This would include an attribute
      that starts with the reserved letters "xml", e.g. <foo

   c. Using other predefined XML syntax, e.g., a PI: <?xml-class

2. In the CSS style sheet:

   a. Scoped to one CSS file: Something like this near the top of the
      file: @class "attributename";

   b. Scoped to an XML namespace:
      @namespace html url(http://www.w3.org/xhtml1-strict) class="class";

   c. Explicitly scoped: @class "attributename" {... rules... }

3. Always bind it to an attribute called "class." If there isn't any:
   bad luck.

My current opinion: I think (1) looks ugly and (3) is too limited.
(2a) has my preference, but it may mean you have to split a style
sheet into several files if your document mixes namespaces. (2b) is
more complex, but doesn't have that disadvantage. I don't like (2c),
because it introduces an extra level of nesting, which will scare too
many potential CSS authors.

We probably have to look at the problems of class, ID and embedded
styles together: we have a problem with #id selectors, since you may
not always know which attribute is the ID. And embedded styles (style
attribute) are occasionally convenient as well.

 > reason: dot notation for class as used in HTML+CSS is so convenient, that I
 > imagine it will be highly requested by authors of XML-based documents and
 > implemented by the browser manufacturers, regardless of its official status:

  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Thursday, 5 August 1999 10:53:41 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:51 UTC