Remove webelem.Group.prevnext

Apart from checking for buttons with an href attribute (which made no sense at
all and should never return any element) this was identical to
webelem.Group.links.
This commit is contained in:
Florian Bruhin 2017-05-12 09:18:58 +02:00
parent 203a5dff74
commit 9e2aa65c02
3 changed files with 7 additions and 14 deletions

View File

@ -141,6 +141,5 @@ def prevnext(*, browsertab, win_id, baseurl, prev=False,
else:
browsertab.openurl(url)
selector = ', '.join([webelem.SELECTORS[webelem.Group.links],
webelem.SELECTORS[webelem.Group.prevnext]])
browsertab.elements.find_css(selector, _prevnext_cb)
browsertab.elements.find_css(webelem.SELECTORS[webelem.Group.links],
_prevnext_cb)

View File

@ -34,8 +34,7 @@ from qutebrowser.keyinput import modeman
from qutebrowser.utils import log, usertypes, utils, qtutils, objreg
Group = usertypes.enum('Group', ['all', 'links', 'images', 'url', 'prevnext',
'inputs'])
Group = usertypes.enum('Group', ['all', 'links', 'images', 'url', 'inputs'])
SELECTORS = {
@ -45,8 +44,6 @@ SELECTORS = {
Group.links: 'a[href], area[href], link[href], [role=link][href]',
Group.images: 'img',
Group.url: '[src], [href]',
Group.prevnext: 'a[href], area[href], button[href], link[href], '
'[role=button][href]',
Group.inputs: ('input[type=text], input[type=email], input[type=url], '
'input[type=tel], input[type=number], '
'input[type=password], input[type=search], '

View File

@ -147,19 +147,18 @@ class SelectionAndFilterTests:
('<a />', [webelem.Group.all]),
('<a href="foo" />', [webelem.Group.all, webelem.Group.links,
webelem.Group.prevnext, webelem.Group.url]),
webelem.Group.url]),
('<a href="javascript://foo" />', [webelem.Group.all,
webelem.Group.links,
webelem.Group.prevnext,
webelem.Group.url]),
('<area />', [webelem.Group.all]),
('<area href="foo" />', [webelem.Group.all, webelem.Group.links,
webelem.Group.prevnext, webelem.Group.url]),
webelem.Group.url]),
('<link />', [webelem.Group.all]),
('<link href="foo" />', [webelem.Group.all, webelem.Group.links,
webelem.Group.prevnext, webelem.Group.url]),
webelem.Group.url]),
('<textarea />', [webelem.Group.all, webelem.Group.inputs]),
('<select />', [webelem.Group.all]),
@ -176,8 +175,7 @@ class SelectionAndFilterTests:
('<input type="search" />', [webelem.Group.inputs, webelem.Group.all]),
('<button />', [webelem.Group.all]),
('<button href="foo" />', [webelem.Group.all, webelem.Group.prevnext,
webelem.Group.url]),
('<button href="foo" />', [webelem.Group.all, webelem.Group.url]),
# We can't easily test <frame>/<iframe> as they vanish when setting
# them via QWebFrame::setHtml...
@ -187,7 +185,6 @@ class SelectionAndFilterTests:
('<p role="option" foo="bar"/>', [webelem.Group.all]),
('<p role="button" foo="bar"/>', [webelem.Group.all]),
('<p role="button" href="bar"/>', [webelem.Group.all,
webelem.Group.prevnext,
webelem.Group.url]),
]