Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for :empty #20

Merged
merged 1 commit into from
Nov 15, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cssselect/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ def xpath(css):
assert xpath('e:only-of-type') == (
"e[last() = 1]")
assert xpath('e:empty') == (
"e[not(*) and not(normalize-space())]")
"e[not(*) and not(string-length())]")
assert xpath('e:EmPTY') == (
"e[not(*) and not(normalize-space())]")
"e[not(*) and not(string-length())]")
assert xpath('e:root') == (
"e[not(parent::*)]")
assert xpath('e:hover') == (
Expand Down Expand Up @@ -575,7 +575,7 @@ def pcss(main, *selectors, **kwargs):
assert pcss('p:only-of-type') == ['paragraph']
assert pcss('a:empty', 'a:EMpty') == ['name-anchor']
assert pcss('li:empty') == [
'third-li', 'fourth-li', 'fifth-li', 'sixth-li', 'seventh-li']
'third-li', 'fourth-li', 'fifth-li', 'sixth-li']
assert pcss(':root', 'html:root') == ['html']
assert pcss('li:root', '* :root') == []
assert pcss('*:contains("link")', ':CONtains("link")') == [
Expand Down
2 changes: 1 addition & 1 deletion cssselect/xpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def xpath_only_of_type_pseudo(self, xpath):
return xpath.add_condition('last() = 1')

def xpath_empty_pseudo(self, xpath):
return xpath.add_condition("not(*) and not(normalize-space())")
return xpath.add_condition("not(*) and not(string-length())")

def pseudo_never_matches(self, xpath):
"""Common implementation for pseudo-classes that never match."""
Expand Down