diff --git a/qutebrowser/browser/navigate.py b/qutebrowser/browser/navigate.py index 5abfbe0b4..aacec9d3c 100644 --- a/qutebrowser/browser/navigate.py +++ b/qutebrowser/browser/navigate.py @@ -70,11 +70,11 @@ def path_up(url, count): def _find_prevnext(prev, elems): """Find a prev/next element in the given list of elements.""" # First check for - rel_values = ('prev', 'previous') if prev else ('next') + rel_values = {'prev', 'previous'} if prev else {'next'} for e in elems: if e.tag_name() not in ['link', 'a'] or 'rel' not in e: continue - if e['rel'] in rel_values: + if set(e['rel'].split(' ')) & rel_values: log.hints.debug("Found {!r} with rel={}".format(e, e['rel'])) return e diff --git a/tests/end2end/data/navigate/rel_nofollow.html b/tests/end2end/data/navigate/rel_nofollow.html new file mode 100644 index 000000000..d6f7fd3e8 --- /dev/null +++ b/tests/end2end/data/navigate/rel_nofollow.html @@ -0,0 +1,12 @@ + + +
+ +Index page
+ bla + blub + + diff --git a/tests/end2end/features/navigate.feature b/tests/end2end/features/navigate.feature index 4b6b7f82e..5153400a4 100644 --- a/tests/end2end/features/navigate.feature +++ b/tests/end2end/features/navigate.feature @@ -53,6 +53,16 @@ Feature: Using :navigate And I run :navigate next Then data/navigate/next.html should be loaded + Scenario: Navigating to previous page with rel nofollow + When I open data/navigate/rel_nofollow.html + And I run :navigate prev + Then data/navigate/prev.html should be loaded + + Scenario: Navigating to next page with rel nofollow + When I open data/navigate/rel_nofollow.html + And I run :navigate next + Then data/navigate/next.html should be loaded + # increment/decrement Scenario: Incrementing number in URL