Re: draft-ietf-html-style-00.txt & class as a general selector

lilley (lilley@afs.mcc.ac.uk)
Thu, 7 Dec 1995 18:21:57 +0000 (GMT)


cwilso@microsoft.com said:
> h&kon said:
> > [CLASS="foo"] { color: blue }
> > *.foo { color: blue }
> > .foo { color: blue }
>
> I agree that the first one is a little verbose, but it seems to fit nicely
> with the proposed addressing in CSS2. I intensely dislike the second,
> because, as you said, it seems to indicate that any form of wildcards would
> work. The third fits nicely (hmm, it might fall out of a parser easily),
> but does sort of look like a typo.

What purpose do all the [] and "" serve in the first example?

It would really be simpler if CSS decided what operators were needed and thus
defined what tokens it would need, rather than typing in some possible
notation and then deciding what the bits might mean...

{ delimits the selector from the declaration
} terminates the declaration
whitespace (space, tab, cr, lf) is ignored

In the third example, . means "a class called" but this does not seem
to scale well, particularly when CSS is later used for other DTDs which
might not have a class attribute (or might have one that means something
else)

Selectors can at present be GIDs or attributes, right? (And CSS 1 only
supports the CLASS and ID attributes, but that will be relaxed,
correct?) And CSS 1 presently supports the syntactic sugar a.b means
GID a with attribute CLASS = b

Given that, it becomes clear that the third example is correct, or
at least, most consistent with existing usage.

So, for generality and a clear upgrade path to CSS 2 how about some
token to say, here is an attribute, and another token to say, here is
it's value. Let's use @ and = for these, though the representation
could be some other token. I just thought @ (at) was memorable for
"attribute" and = seemed obvious for "has the value"

We then have (spacing is up to you):

bar { something } all bar elements

bar @CLASS = foo { something } all bar elements with class attribute foo
bar @ID = foo { something } all bar elements with id atribute foo
bar @LANG = foo all bar elements with lang atribute foo
(and so on)

@CLASS = foo { something } all elements with class attribute foo

Which seems fairly regular and easy to parse - properly bracketed. Then
for notational convenience, when using CSS with HTML, we have the
following short forms:

. means @CLASS =
# means @ID = or whatever token is chosen

So

bar.foo {something } all bar elements with class attribute foo
.foo { something } all elements with class attribute foo
#42 { something } the element with id attribute 42

This gives a concise and regular notation, it seems.

-- 
Chris Lilley, Technical Author and JISC representative to W3C 
+-------------------------------------------------------------------+
|  Manchester and North Training & Education Centre   ( MAN T&EC )  |
+-------------------------------------------------------------------+
| Computer Graphics Unit,             Email: Chris.Lilley@mcc.ac.uk |
| Manchester Computing Centre,        Voice: +44 161 275 6045       |
| Oxford Road, Manchester, UK.          Fax: +44 161 275 6040       |
| M13 9PL                            BioMOO: ChrisL                 |
| Timezone: UTC        URI: http://info.mcc.ac.uk/CGU/staff/lilley/ | 
+-------------------------------------------------------------------+