Merge branch 'navigate-fix' of https://github.com/EliteTK/qutebrowser into EliteTK-navigate-fix
This commit is contained in:
commit
389501deb9
@ -70,11 +70,11 @@ def path_up(url, count):
|
|||||||
def _find_prevnext(prev, elems):
|
def _find_prevnext(prev, elems):
|
||||||
"""Find a prev/next element in the given list of elements."""
|
"""Find a prev/next element in the given list of elements."""
|
||||||
# First check for <link rel="prev(ious)|next">
|
# First check for <link rel="prev(ious)|next">
|
||||||
rel_values = ('prev', 'previous') if prev else ('next')
|
rel_values = {'prev', 'previous'} if prev else {'next'}
|
||||||
for e in elems:
|
for e in elems:
|
||||||
if e.tag_name() not in ['link', 'a'] or 'rel' not in e:
|
if e.tag_name() not in ['link', 'a'] or 'rel' not in e:
|
||||||
continue
|
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']))
|
log.hints.debug("Found {!r} with rel={}".format(e, e['rel']))
|
||||||
return e
|
return e
|
||||||
|
|
||||||
|
12
tests/end2end/data/navigate/rel_nofollow.html
Normal file
12
tests/end2end/data/navigate/rel_nofollow.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Navigate</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Index page</p>
|
||||||
|
<a href="/data/navigate/prev.html" rel="nofollow prev">bla</a>
|
||||||
|
<a href="/data/navigate/next.html" rel="nofollow next">blub</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -53,6 +53,16 @@ Feature: Using :navigate
|
|||||||
And I run :navigate next
|
And I run :navigate next
|
||||||
Then data/navigate/next.html should be loaded
|
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
|
# increment/decrement
|
||||||
|
|
||||||
Scenario: Incrementing number in URL
|
Scenario: Incrementing number in URL
|
||||||
|
Loading…
Reference in New Issue
Block a user