@@ -107,15 +107,15 @@ private function parseSelectorList(TokenStream $stream): array
107
107
return $ selectors ;
108
108
}
109
109
110
- private function parserSelectorNode (TokenStream $ stream, bool $ insideRelation = false ): Node \SelectorNode
110
+ private function parserSelectorNode (TokenStream $ stream ): Node \SelectorNode
111
111
{
112
- [$ result , $ pseudoElement ] = $ this ->parseSimpleSelector ($ stream , false , $ insideRelation );
112
+ [$ result , $ pseudoElement ] = $ this ->parseSimpleSelector ($ stream , false );
113
113
114
114
while (true ) {
115
115
$ stream ->skipWhitespace ();
116
116
$ peek = $ stream ->getPeek ();
117
117
118
- if ($ peek ->isFileEnd () || $ peek ->isDelimiter ([', ' ]) || ( $ insideRelation && $ peek -> isDelimiter ([ ' ) ' ])) ) {
118
+ if ($ peek ->isFileEnd () || $ peek ->isDelimiter ([', ' ])) {
119
119
break ;
120
120
}
121
121
@@ -130,7 +130,7 @@ private function parserSelectorNode(TokenStream $stream, bool $insideRelation =
130
130
$ combinator = ' ' ;
131
131
}
132
132
133
- [$ nextSelector , $ pseudoElement ] = $ this ->parseSimpleSelector ($ stream , false , $ insideRelation );
133
+ [$ nextSelector , $ pseudoElement ] = $ this ->parseSimpleSelector ($ stream , false );
134
134
$ result = new Node \CombinedSelectorNode ($ result , $ combinator , $ nextSelector );
135
135
}
136
136
@@ -142,7 +142,7 @@ private function parserSelectorNode(TokenStream $stream, bool $insideRelation =
142
142
*
143
143
* @throws SyntaxErrorException
144
144
*/
145
- private function parseSimpleSelector (TokenStream $ stream , bool $ insideNegation = false , bool $ insideRelation = false ): array
145
+ private function parseSimpleSelector (TokenStream $ stream , bool $ insideNegation = false ): array
146
146
{
147
147
$ stream ->skipWhitespace ();
148
148
@@ -156,7 +156,6 @@ private function parseSimpleSelector(TokenStream $stream, bool $insideNegation =
156
156
|| $ peek ->isFileEnd ()
157
157
|| $ peek ->isDelimiter ([', ' , '+ ' , '> ' , '~ ' ])
158
158
|| ($ insideNegation && $ peek ->isDelimiter ([') ' ]))
159
- || ($ insideRelation && $ peek ->isDelimiter ([') ' ]))
160
159
) {
161
160
break ;
162
161
}
@@ -219,13 +218,10 @@ private function parseSimpleSelector(TokenStream $stream, bool $insideNegation =
219
218
220
219
$ result = new Node \NegationNode ($ result , $ argument );
221
220
} elseif ('has ' === strtolower ($ identifier )) {
222
- if ($ insideRelation ) {
223
- throw SyntaxErrorException::nestedHas ();
224
- }
225
221
226
222
[$ combinator , $ subSelector ] = $ this ->parseRelativeNode ($ stream );
227
-
228
223
$ result = new Node \RelationNode ($ result , $ combinator ,$ subSelector );
224
+
229
225
} else {
230
226
$ arguments = [];
231
227
$ next = null ;
@@ -258,7 +254,7 @@ private function parseSimpleSelector(TokenStream $stream, bool $insideNegation =
258
254
}
259
255
}
260
256
261
- if (\count ($ stream ->getUsed ()) === $ selectorStart && ! $ insideRelation ) {
257
+ if (\count ($ stream ->getUsed ()) === $ selectorStart ) {
262
258
throw SyntaxErrorException::unexpectedToken ('selector ' , $ stream ->getPeek ());
263
259
}
264
260
0 commit comments