Skip to content

Commit c4ef8c8

Browse files
annbgnelacuesta
authored andcommitted
allow :has() arguments start not solely from a combinator
Co-authored-by: Eugenio Lacuesta <[email protected]>
1 parent c44c595 commit c4ef8c8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cssselect/parser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,8 @@ def parse_relative_selector(stream):
597597
next = stream.next()
598598
if next in [('DELIM', '+'), ('DELIM', '-'), ('DELIM', '>'), ('DELIM', '~')]:
599599
arguments.append(next)
600+
elif next.type in ('IDENT', 'STRING', 'NUMBER'):
601+
arguments.append(Element(element=next.value))
600602
while 1:
601603
stream.skip_whitespace()
602604
next = stream.next()

cssselect/xpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def xpath_negation(self, negation):
274274

275275
def xpath_relation(self, relation):
276276
xpath = self.xpath(relation.selector)
277-
combinator, subselector, *_ = relation.subselector
277+
combinator, subselector = relation.subselector
278278
method = getattr(self, 'xpath_%s_combinator' % self.combinator_mapping[combinator.value])
279279
return method(xpath, self.xpath(subselector))
280280

0 commit comments

Comments
 (0)