From bd8ead2279c66526554909df5f6ce848ab496a23 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 11 Feb 2017 20:48:01 +0100 Subject: [PATCH] Detect rel-attributes on elements for :navigate --- CHANGELOG.asciidoc | 1 + qutebrowser/browser/navigate.py | 2 +- tests/end2end/data/navigate/rel.html | 12 ++++++++++++ tests/end2end/features/navigate.feature | 10 ++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/end2end/data/navigate/rel.html diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index df0b28ad9..5deca80d4 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -65,6 +65,7 @@ Fixed - Fixed showing of keybindings in the :help completion - Worked around a segfault when opening a URL after a QtWebEngine renderer process crash - Using :undo or :tab-clone with a view-source:// or chrome:// tab is now prevented, as it segfaults +- `:navigate prev/next` now detects `rel` attributes on `` elements v0.9.1 ------ diff --git a/qutebrowser/browser/navigate.py b/qutebrowser/browser/navigate.py index 395d4e166..5abfbe0b4 100644 --- a/qutebrowser/browser/navigate.py +++ b/qutebrowser/browser/navigate.py @@ -72,7 +72,7 @@ def _find_prevnext(prev, elems): # First check for rel_values = ('prev', 'previous') if prev else ('next') for e in elems: - if e.tag_name() != 'link' or 'rel' not in e: + if e.tag_name() not in ['link', 'a'] or 'rel' not in e: continue if e['rel'] in rel_values: log.hints.debug("Found {!r} with rel={}".format(e, e['rel'])) diff --git a/tests/end2end/data/navigate/rel.html b/tests/end2end/data/navigate/rel.html new file mode 100644 index 000000000..48a5895b8 --- /dev/null +++ b/tests/end2end/data/navigate/rel.html @@ -0,0 +1,12 @@ + + + + + Navigate + + +

Index page

+
+ + + diff --git a/tests/end2end/features/navigate.feature b/tests/end2end/features/navigate.feature index 956229f09..4b6b7f82e 100644 --- a/tests/end2end/features/navigate.feature +++ b/tests/end2end/features/navigate.feature @@ -43,6 +43,16 @@ Feature: Using :navigate And I run :navigate next Then data/navigate/next.html should be loaded + Scenario: Navigating to previous page with rel + When I open data/navigate/rel.html + And I run :navigate prev + Then data/navigate/prev.html should be loaded + + Scenario: Navigating to next page with rel + When I open data/navigate/rel.html + And I run :navigate next + Then data/navigate/next.html should be loaded + # increment/decrement Scenario: Incrementing number in URL