Index: Source/core/css/parser/CSSGrammar.y |
diff --git a/Source/core/css/parser/CSSGrammar.y b/Source/core/css/parser/CSSGrammar.y |
index ad8fe0322cb396b3c127c4d5227c0745214ab703..a73200f0242dc1c875342b123013900653b712be 100644 |
--- a/Source/core/css/parser/CSSGrammar.y |
+++ b/Source/core/css/parser/CSSGrammar.y |
@@ -1353,7 +1353,8 @@ pseudo: |
parser->tokenToLowerCase($3); |
$$->setValue($3); |
CSSSelector::PseudoType type = $$->pseudoType(); |
- if (type == CSSSelector::PseudoUnknown) { |
+ if (type == CSSSelector::PseudoUnknown || |
+ !parser->isSelectorAllowedInParsingMode(type)) { |
parser->reportError($2, InvalidSelectorPseudoCSSError); |
YYERROR; |
} |
@@ -1367,7 +1368,8 @@ pseudo: |
$$->setValue($4); |
// FIXME: This call is needed to force selector to compute the pseudoType early enough. |
CSSSelector::PseudoType type = $$->pseudoType(); |
- if (type == CSSSelector::PseudoUnknown) { |
+ if (type == CSSSelector::PseudoUnknown || |
+ !parser->isSelectorAllowedInParsingMode(type)) { |
parser->reportError($3, InvalidSelectorPseudoCSSError); |
YYERROR; |
} |