- From: Francois Remy <fremycompany_pub@yahoo.fr>
- Date: Fri, 25 Jul 2008 12:35:25 +0200
- To: "Andrew Fedoniouk" <news@terrainformatica.com>
- Cc: "Boris Zbarsky" <bzbarsky@MIT.EDU>, "www-style list" <www-style@w3.org>
From: "Andrew Fedoniouk" <news@terrainformatica.com> > > Francois Remy wrote: >> >> From: "Andrew Fedoniouk" <news@terrainformatica.com> >>> >>> Francois Remy wrote: >>>> >>>> Yes, there's another solution : you can watch change applied on the >>>> elements that can change the value of the rule. >>>> But it's not possible to know when an element changes in JScript... >>> >>> Imagine that I you have some event that is fired when one of its >>> attributes, states or its subtree is getting changed. >>> (Lets put aside for the second when such an event needs to be fired) >>> >>> How it will help you? >> >> You don't need to run the whole selector each time there's a DOM >> modification, only each one that are applying on elements that are >> concerned by the rule. > > First: > > Let's say for the selector: > > html:with-child(a:hover) p > { > border: 1px solid green; > } > > what would be the mechanism that does "only each one > that are applying on elements that are concerned by the rule"? The document must be hooked : - Each time a new element is added to the DOM, we must check if it match the rule Any HTML element must be hooked : - Each time a new element is added to the DOM, we must check if the HTML element now match the rule (a:href added) or if it match a rule (a or p) Any A element of the HTML element must be hooked : - Each time an element get of loose :href, we need to check if the HTML element now match the rule Any P element of the HTML element must be hooked : - No condition here, but if it was P[title], we should check each time the title attribute is modified on a P element child of HTML to see if it match the rule > > Second: > > Consider these two selectors: > > p > { > border: none; > } > > html:with-child(a:hover) p > { > border: 2em; > } > > and markup: > > <html> > <p><a href="*">sample</a></p> > </html> > > In such case selector above will never be true > if to assume that computation of selectors happens instantly. > > On real world PCs with finite time needed for computation you > will see nice oscillation. a { display: block } a:hover { display: none; } And this one ? Bad use of :hover selector is not linked to with-child. > > > -- > Andrew Fedoniouk. > > http://terrainformatica.com >
Received on Friday, 25 July 2008 10:36:04 UTC