Re: [libcroco-list] more on selectors



Dodji Seketeli wrote:

As an example, let consider the xml document (doc.xml):
============
<?xml version="1.0" ?>
<root><A/><B/></root>
======================

and the CSS stylesheet (doc.css)
==================
A + B {
  color: b-color ;
}
=================

The ruleset A + B {..} correctly selects the element <B/> of the
doc.xml.

hmm, the way I read the spec means 'A' should be selected, not 'B'.
(i.e. 'an A if followed by a B', the equivalent of the xpath 'a[b]').

But if you consider the xml document (doc.xml):
==================
<?xml version="1.0" ?>
<root><A/> <B/></root>
==================
(note the space between <A/> and <B/>)

The ruleset A + B {...} does not selects the element <B/> because the selection engine considers that the element B does not immediatly
follows element A.

right.

And I think this is a bug. Because from what I understand from the
CSS2 spec, CSS2 selectors applies to element nodes only, unless a
special pseudo-class type selector comes into play.

Dunno, I'm not (yet) familiar enough with css.

I already have a patch for this on my source tree and I will commit it
soonish in the CVS HEAD.

As of the pseudo-class selection, yes some more code is needed to
handle them, even if not all of them will be easy to support.
Do not hesitate to ask if you want them to be supported. We will
start a discussion about it.

I do believe ':first-child' should be handled. I don't understand
why you say it is dynamic. From my understanding 'dynamic' means
'as a result of user interaction', i.e. things like 'hover' and
other elements that require more than just the statically available
information. 'first-child', however, is strictly structural, i.e.
you can know it from the topology of the tree. It's no different
from the 'A + B' selector, no ?

Regards,
		Stefan





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]