Skip to content

Commit

Permalink
Merge pull request #88 from sjp/master
Browse files Browse the repository at this point in the history
Parse |ident as ident. No longer an error.
  • Loading branch information
kmike authored Aug 1, 2019
2 parents 99bc54c + 81c8dab commit 02ec77c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cssselect/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,9 @@ def parse_simple_selector(stream, inside_negation=False):
elif peek == ('DELIM', '.'):
stream.next()
result = Class(result, stream.next_ident())
elif peek == ('DELIM', '|'):
stream.next()
result = Element(None, stream.next_ident())
elif peek == ('DELIM', '['):
stream.next()
result = parse_attrib(result, stream)
Expand Down
1 change: 1 addition & 0 deletions tests/test_cssselect.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def parse_many(first, *others):
assert parse_many('*') == ['Element[*]']
assert parse_many('*|*') == ['Element[*]']
assert parse_many('*|foo') == ['Element[foo]']
assert parse_many('|foo') == ['Element[foo]']
assert parse_many('foo|*') == ['Element[foo|*]']
assert parse_many('foo|bar') == ['Element[foo|bar]']
# This will never match, but it is valid:
Expand Down

0 comments on commit 02ec77c

Please sign in to comment.