Rule matching oddness with new CSS parser
David Hyatt
khtml-devel@kde.org
Fri, 21 Feb 2003 14:18:32 -0800
Ok, this behavior exactly matches the old parser (and all my test cases
finally pass, yay!).
The old parser chains the sub-selectors inside simple selectors from
left to right. It then hands back the leftmost subselector. This
production matches that behavior:
specifier_list specifier {
$$ = $1;
CSSSelector *end = $1;
while( end->tagHistory )
end = end->tagHistory;
end->relation = CSSSelector::SubSelector;
end->tagHistory = $2;
}
For complex selectors the old parser chained the simple selectors from
right to left. The rightmost link in a simple selector would point to
the leftmost link in the next simple selector. This production matches
that behavior.
selector combinator simple_selector {
$$ = $3;
CSSSelector *end = $3;
while( end->tagHistory )
end = end->tagHistory;
end->relation = $2;
end->tagHistory = $1;
}
dave
(hyatt@apple.com)