Index: Source/core/css/parser/CSSGrammar.y |
diff --git a/Source/core/css/parser/CSSGrammar.y b/Source/core/css/parser/CSSGrammar.y |
index b968c717c242d3a803fc64c17103380b27320063..82a920e42e40360547cab4c48713f4f37da626a3 100644 |
--- a/Source/core/css/parser/CSSGrammar.y |
+++ b/Source/core/css/parser/CSSGrammar.y |
@@ -1342,7 +1342,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; |
} |
@@ -1356,7 +1357,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; |
} |