The properties field contains the style that is valid for the corresponding selector path denoted by the position in the tree. Accordingly, the properties field of the root style sheet contains the Style that is applied for the "*" selector (matching anything).
To apply the style sheet, the tree is visited in a depth first search for matching selector parts. Each visited node with a non-empty properties field is inserted in a queue. The queue is ordered by the specificity of the node.
After all matching selectors were visited, the StyleSheet objects are fetched from the queue in the order of ascending specificity and their properties are applied. Thus, values denoted by more specific selectors overwrite values from less specific rules.
Note that child and descendant selectors are inverted, so the evaluation of a style sheet can always start at the element it is applied to. @author Stefan Haustein
|
|