Re: CSS3 module: W3C selectors

Jeff Carlson wrote:
> I just read the Last Call Working Draft of CSS3 module: W3C selectors and
> have a question.
> Why is the W3C selector syntax such a departure from XPath syntax?

To put that question in its correct chronological order, why was XPath such
a departure from W3C selectors? The reason was that XPath was optimised for
a different area of application - they went for a more fully general syntax
at the expense of being more batch-oriented. W3C selectors are tuned for
progressive display of streaming documents and efficient real-time
animation using the CSS object model or SMIL animation.

> XPath seems perfect for selector functionality.
> It is already used for accessing nodes in the XML DOM, XSLT, etc.
> I'm just now getting into CSS in detail, and perhaps this is a
> backward-compatibility issue.
> Does CSS1 or CSS2 already contain the W3C selector type of node addressing?

Yes, CSS1 and CSS2 already use this selector syntax.

> Or, does XPath fall short of what is required for CSS3 selectors?

It falls short in the area of dynamic viewing, since it is not possible to
do selection until the entire document has been downloaded; progressive
display is not possible. It also lacks the ability to select pseudoelements
and pseudoclasses. However, it is well suited for its intended purpose.

> If not, it seems a shame to introduce another syntax when we could hit the
> ground running with an existing one.

I agree that XPath could have been designed as an extension to selector
syntax, but it was not, and it is far too late to change that now.

> Perhaps I should have checked the www-style archives before asking this
> question. :-)

Yes, also the CSS1 and CSS2 specifications ;=) But never mind, perhaps
other people were wondering the same thing.


Received on Monday, 5 February 2001 22:04:06 UTC