|
@@ -514,7 +514,7 @@ begin
|
|
case aBinary.Operation of
|
|
case aBinary.Operation of
|
|
boGT:
|
|
boGT:
|
|
begin
|
|
begin
|
|
- // child combinator
|
|
|
|
|
|
+ // child combinator >
|
|
Result:=SelectorMatches(aBinary.Right,TestNode);
|
|
Result:=SelectorMatches(aBinary.Right,TestNode);
|
|
if Result<0 then exit;
|
|
if Result<0 then exit;
|
|
aParent:=TestNode.GetCSSParent;
|
|
aParent:=TestNode.GetCSSParent;
|
|
@@ -527,7 +527,7 @@ begin
|
|
end;
|
|
end;
|
|
boPlus:
|
|
boPlus:
|
|
begin
|
|
begin
|
|
- // adjacent sibling combinator
|
|
|
|
|
|
+ // adjacent sibling combinator +
|
|
Result:=SelectorMatches(aBinary.Right,TestNode);
|
|
Result:=SelectorMatches(aBinary.Right,TestNode);
|
|
if Result<0 then exit;
|
|
if Result<0 then exit;
|
|
Sibling:=TestNode.GetCSSPreviousSibling;
|
|
Sibling:=TestNode.GetCSSPreviousSibling;
|
|
@@ -540,7 +540,7 @@ begin
|
|
end;
|
|
end;
|
|
boTilde:
|
|
boTilde:
|
|
begin
|
|
begin
|
|
- // general sibling combinator
|
|
|
|
|
|
+ // general sibling combinator ~
|
|
Result:=SelectorMatches(aBinary.Right,TestNode);
|
|
Result:=SelectorMatches(aBinary.Right,TestNode);
|
|
if Result<0 then exit;
|
|
if Result<0 then exit;
|
|
Sibling:=TestNode.GetCSSPreviousSibling;
|
|
Sibling:=TestNode.GetCSSPreviousSibling;
|
|
@@ -558,6 +558,26 @@ begin
|
|
end;
|
|
end;
|
|
Result:=CSSSpecifityNoMatch;
|
|
Result:=CSSSpecifityNoMatch;
|
|
end;
|
|
end;
|
|
|
|
+ boWhiteSpace:
|
|
|
|
+ begin
|
|
|
|
+ // descendant combinator
|
|
|
|
+ Result:=SelectorMatches(aBinary.Right,TestNode);
|
|
|
|
+ if Result<0 then exit;
|
|
|
|
+ aParent:=TestNode;
|
|
|
|
+ repeat
|
|
|
|
+ aParent:=aParent.GetCSSParent;
|
|
|
|
+ if aParent=nil then
|
|
|
|
+ exit(CSSSpecifityNoMatch);
|
|
|
|
+ aSpecifity:=SelectorMatches(aBinary.Left,aParent);
|
|
|
|
+ if aSpecifity>=0 then
|
|
|
|
+ begin
|
|
|
|
+ inc(Result,aSpecifity);
|
|
|
|
+ exit;
|
|
|
|
+ end
|
|
|
|
+ else if aSpecifity=CSSSpecifityInvalid then
|
|
|
|
+ exit(CSSSpecifityInvalid);
|
|
|
|
+ until false;
|
|
|
|
+ end
|
|
else
|
|
else
|
|
if croErrorOnUnknownName in Options then
|
|
if croErrorOnUnknownName in Options then
|
|
DoError(20220910123724,'Invalid CSS binary selector '+BinaryOperators[aBinary.Operation],aBinary);
|
|
DoError(20220910123724,'Invalid CSS binary selector '+BinaryOperators[aBinary.Operation],aBinary);
|