diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 7e6e0575e..e8198050c 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -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 diff --git a/qutebrowser/browser/webelem.py b/qutebrowser/browser/webelem.py index 01be68b3f..494d04d16 100644 --- a/qutebrowser/browser/webelem.py +++ b/qutebrowser/browser/webelem.py @@ -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, }