Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #20 from sjp/master

Have :empty not match whitespace-only elements.
  • Loading branch information...
commit 653a5a56793bcb9271589305e39da42b773ea973 2 parents 7712c2a + ac10a36
@SimonSapin authored
Showing with 4 additions and 4 deletions.
  1. +3 −3 cssselect/tests.py
  2. +1 −1  cssselect/xpath.py
View
6 cssselect/tests.py
@@ -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') == (
@@ -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")') == [
View
2  cssselect/xpath.py
@@ -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."""
Please sign in to comment.
Something went wrong with that request. Please try again.