parent
e15dc3d0b6
commit
656440b5ee
1 changed files with 2 additions and 2 deletions
|
|
@ -497,8 +497,8 @@ class HTMLPage(Page):
|
||||||
>>> len(root.xpath('//b[has-class("not-exists")]'))
|
>>> len(root.xpath('//b[has-class("not-exists")]'))
|
||||||
0
|
0
|
||||||
"""
|
"""
|
||||||
expressions = ' and '.join(["contains(concat(' ', normalize-space(@class), ' '), ' {} ')".format(c) for c in classes])
|
expressions = ' and '.join(["contains(concat(' ', normalize-space(@class), ' '), ' {0} ')".format(c) for c in classes])
|
||||||
xpath = 'self::*[@class and {}]'.format(expressions)
|
xpath = 'self::*[@class and {0}]'.format(expressions)
|
||||||
return bool(context.context_node.xpath(xpath))
|
return bool(context.context_node.xpath(xpath))
|
||||||
ns['has-class'] = has_class
|
ns['has-class'] = has_class
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue