[Lxml-checkins] r44682 - lxml/branch/html/src/lxml/html

ianb at codespeak.net ianb at codespeak.net
Tue Jul 3 01:26:02 CEST 2007


Author: ianb
Date: Tue Jul  3 01:26:00 2007
New Revision: 44682

Modified:
   lxml/branch/html/src/lxml/html/css.py
Log:
Fix a problem with nth-last-child; adjust el:empty a little

Modified: lxml/branch/html/src/lxml/html/css.py
==============================================================================
--- lxml/branch/html/src/lxml/html/css.py	(original)
+++ lxml/branch/html/src/lxml/html/css.py	Tue Jul  3 01:26:00 2007
@@ -110,7 +110,7 @@
     def _xpath_nth_child(self, xpath, expr, last=False,
                          add_name_test=True):
         a, b = parse_series(expr)
-        if not a and not b:
+        if not a and not b and not last:
             # a=0 means nothing is returned...
             xpath.add_condition('false() and position() = 0')
             return xpath
@@ -270,7 +270,7 @@
         return xpath
 
     def _xpath_empty(self, xpath):
-        xpath.add_condition("count(./child::*) = 0 and normalize-space(.) = ''")
+        xpath.add_condition("not(*) and not(normalize-space())")
         return xpath
 
 class Attrib(object):


More information about the lxml-checkins mailing list