Re: Extensions to CSS3 selectors

On Tue, 25 Apr 2000, Jonas Sicking wrote:
> On Sunday, April 23 2000, Ian Graham wrote
> 
> > On Sat, 22 Apr 2000, Tim Bannister wrote:
> >
> > > On Fri, 21 Apr 2000, Jonas Sicking wrote:
> > >
> > I would suggest (see [1]) the following specification:
> >
> > :empty  The Empty-Element Pseudo-Class.
> >
> >   The empty-element pseudo classes matches elements that are empty
> >   of significant content. In this context, "empty of significant
> >   content" has the following meanings depending on how the markup
> >   is being processed:
> >
> >   1) If the data are being processed by an HTML processor, then an
> >      element is empty of significant content if:
> >      (a) The element is an HTML element declared to be empty, or
> >      (b) The element consists of a start and stop tag, but the
> >          content of the element consists only of zero or more
> >          white space characters. White space
> >          characters are defined as in production 3 of the
> >          XML 1.0 specification, namely:
> >          (#x20 | #x9 | #xD | #xA)+
> >
> >   2) If the data are being processed by an XML processor, then
> >      an element is empty of significant content if:
> >      (a) The element is written as an empty-element tag, or
> >      (b) The element consists of a start and stop tag, but the
> >          content of the element consist only of zero or more
> >          XML white space characters.
> 
> Should whitespace only really be considered insignifican if the element is
> declared to be whitespace preserving? In xhtml (and therefor html?) the
> think the style, script and pre elements are declared to preseve whitespace.
> In XML any tag could be declared to preseve whitespace.

That's a good point. My first though is that, if xml:space="default", then
such elements may or may not become empty after processing (depending on
the way the application deals with white space), so that treating both
cases as 'empty' means that rendering will be the same regardless of how
the processor handles the XML data. IMHO this is the desired behavior.

It's less obvious with xml:space="preserve". HOwever, in this case I would
argue that rules such as 

elem:space[xml:space=default]  { one set of rules}
elem:space[xml:space=preserve] { another set of rules} 

would let you deal with this situation, while preserving the idea that
:empty means 'empty' in the expected sense.

> Another problem I have thought about is <E><!-- comment --></E>. I think
> that this should be considerd empty, but it probobly should be mentioned in
> the spec.

The XML spec says (Section 2.5) that comments are not part of the
document's character data, which clarifies the situation in that case. I
don't believe the HTML spec explicitly says this, however, so I agree that
it is probably worth mentioning here.

> > I should note that Jason Orendorff [1] was the first to sugest
> > this pseudo-class, but the note appeared on the www-html list before
> > the topic got cross-posted to www-style
> >
> > [1] http://lists.w3.org/Archives/Public/www-html/2000Apr/0068.html
> 
> Sorry about this. At the time of my initial post I didn't know that this had
> already been proposed.

Heavens -- no apology needed. I think of it as another example of web
synchronicity ;-)

Ian
--
http://www.utoronto.ca/ian/

Received on Tuesday, 25 April 2000 11:37:13 UTC