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.
|
# Then check for regular links/buttons.
|
||||||
elems = frame.findAllElements(
|
elems = frame.findAllElements(
|
||||||
webelem.SELECTORS[webelem.Group.prevnext])
|
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'
|
option = 'prev-regexes' if prev else 'next-regexes'
|
||||||
if not elems:
|
if not elems:
|
||||||
return None
|
return None
|
||||||
for regex in config.get('hints', option):
|
for regex in config.get('hints', option):
|
||||||
log.hints.vdebug("== Checking regex '{}'.".format(regex.pattern))
|
log.hints.vdebug("== Checking regex '{}'.".format(regex.pattern))
|
||||||
for e in elems:
|
for e in elems:
|
||||||
e = webelem.WebElementWrapper(e)
|
|
||||||
text = str(e)
|
text = str(e)
|
||||||
if not text:
|
if not text:
|
||||||
continue
|
continue
|
||||||
|
@ -52,10 +52,14 @@ SELECTORS = {
|
|||||||
Group.focus: '*:focus',
|
Group.focus: '*:focus',
|
||||||
}
|
}
|
||||||
|
|
||||||
# WORKAROUND for https://bitbucket.org/ned/coveragepy/issues/90
|
|
||||||
FILTERS = { # pragma: no branch
|
def filter_links(elem):
|
||||||
Group.links: (lambda e: 'href' in e and
|
return 'href' in elem and QUrl(elem['href']).scheme() != 'javascript'
|
||||||
QUrl(e['href']).scheme() != 'javascript'),
|
|
||||||
|
|
||||||
|
FILTERS = {
|
||||||
|
Group.links: filter_links,
|
||||||
|
Group.prevnext: filter_links,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user