Re: Select a parrent node with s CSS selector?

  ----- Original Message ----- 
  From: Ilia Goranov 
  To: www-style@w3.org 
  Sent: Sunday, April 22, 2007 11:46 AM
  Subject: Select a parrent node with s CSS selector?


  Hi, as I read the specification proposed for CSS Level 3 I think it is not possible ot create a selector that selects a parent element.

  Example:

  The next selector will apply to each anchor in hover state which is placed inside a paragraph with a class attribute value set to description, which itself is placed inside division with a class attribute value set to content and the division is first level child element of the body element:

  body>div.content p.description a:hover

  However, if I want to apply the rules not to the anchor element, but to the paragraph - I cant set it in the selector. For example If I want to change the color of the whole paragraph when the anchor element is hovered inside.

  The pseudo classes are only an example. It is possible to set a different background to a list element if there is a image inside.

  My proposal to the working group is to use the "less than" character - closing tag brace to set to which part of the selector the rule have to apply. In the example above:

  body>div.content p.description<a:link 




So to find style of p.description CSS engine will need to scan 
1) all parents ( for body>div.content )  
2) *and* all it is children ( for a:link )

Computational complexity of style resolving is O( n * m * d)  currently
where n - number of DOM elements,
m - number of styles.

Your proposal changes the compelxity to O( n * n * m * d )  that is highly non-desirable as you may expect.

Andrew Fedoniouk.
http://terrainformatica.com




  This selector have to apply the defined rules not to the anchor element, but to each paragraph element which contains at least one hiperlink.

  I know that the CSS Level 3 is closed, but I hope it is not too late for the proposal, because Level 4 may not be available soon.

  Thanks
  Ilia Goranov
  babailiica.com

Received on Monday, 23 April 2007 07:26:02 UTC