Skip to content

Commit 02ec77c

Browse files
authored
Merge pull request #88 from sjp/master
Parse |ident as ident. No longer an error.
2 parents 99bc54c + 81c8dab commit 02ec77c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

cssselect/parser.py

+3
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,9 @@ def parse_simple_selector(stream, inside_negation=False):
430430
elif peek == ('DELIM', '.'):
431431
stream.next()
432432
result = Class(result, stream.next_ident())
433+
elif peek == ('DELIM', '|'):
434+
stream.next()
435+
result = Element(None, stream.next_ident())
433436
elif peek == ('DELIM', '['):
434437
stream.next()
435438
result = parse_attrib(result, stream)

tests/test_cssselect.py

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def parse_many(first, *others):
8181
assert parse_many('*') == ['Element[*]']
8282
assert parse_many('*|*') == ['Element[*]']
8383
assert parse_many('*|foo') == ['Element[foo]']
84+
assert parse_many('|foo') == ['Element[foo]']
8485
assert parse_many('foo|*') == ['Element[foo|*]']
8586
assert parse_many('foo|bar') == ['Element[foo|bar]']
8687
# This will never match, but it is valid:

0 commit comments

Comments
 (0)