Filter links for :navigate.
This commit is contained in:
parent
21a60f06c0
commit
0330adf284
@ -596,13 +596,16 @@ class HintManager(QObject):
|
||||
# Then check for regular links/buttons.
|
||||
elems = frame.findAllElements(
|
||||
webelem.SELECTORS[webelem.Group.prevnext])
|
||||
elems = [webelem.WebElementWrapper(e) for e in elems]
|
||||
filterfunc = webelem.FILTERS[webelem.Group.prevnext]
|
||||
elems = [e for e in elems if filterfunc(e)]
|
||||
|
||||
option = 'prev-regexes' if prev else 'next-regexes'
|
||||
if not elems:
|
||||
return None
|
||||
for regex in config.get('hints', option):
|
||||
log.hints.vdebug("== Checking regex '{}'.".format(regex.pattern))
|
||||
for e in elems:
|
||||
e = webelem.WebElementWrapper(e)
|
||||
text = str(e)
|
||||
if not text:
|
||||
continue
|
||||
|
@ -52,10 +52,14 @@ SELECTORS = {
|
||||
Group.focus: '*:focus',
|
||||
}
|
||||
|
||||
# WORKAROUND for https://bitbucket.org/ned/coveragepy/issues/90
|
||||
FILTERS = { # pragma: no branch
|
||||
Group.links: (lambda e: 'href' in e and
|
||||
QUrl(e['href']).scheme() != 'javascript'),
|
||||
|
||||
def filter_links(elem):
|
||||
return 'href' in elem and QUrl(elem['href']).scheme() != 'javascript'
|
||||
|
||||
|
||||
FILTERS = {
|
||||
Group.links: filter_links,
|
||||
Group.prevnext: filter_links,
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user