mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion: Fix regression that caused pseudo-selectors that cannot be resolved such as :hover, :visited, etc. to be removed during conversion
This commit is contained in:
parent
33b5450c9b
commit
f7460f138e
@ -548,6 +548,7 @@ def select_pseudo(cache, pseudo):
|
||||
if pseudo.ident in cache.ignore_inappropriate_pseudo_classes:
|
||||
def func(cache, item):
|
||||
return True
|
||||
func.is_pseudo = True
|
||||
else:
|
||||
raise ExpressionError(
|
||||
"The pseudo-class :%s is not supported" % pseudo.ident)
|
||||
@ -615,5 +616,5 @@ default_dispatch_map = {name.partition('_')[2]:obj for name, obj in globals().it
|
||||
if __name__ == '__main__':
|
||||
from pprint import pprint
|
||||
root = etree.fromstring('<body xmlns="xxx" xml:lang="en"><p id="p" class="one two" lang="fr"><a id="a"/><b/><c/><d/></p></body>')
|
||||
select = Select(root, trace=True)
|
||||
select = Select(root, ignore_inappropriate_pseudo_classes=True, trace=True)
|
||||
pprint(list(select('p:disabled')))
|
||||
|
@ -759,6 +759,9 @@ by William Shakespeare
|
||||
|
||||
self.assertRaises(ExpressionError, lambda : tuple(select('body:nth-child')))
|
||||
|
||||
select = Select(document, ignore_inappropriate_pseudo_classes=True)
|
||||
self.assertGreater(len(tuple(select('p:hover'))), 0)
|
||||
|
||||
del app
|
||||
|
||||
def test_select_shakespeare(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user