Skip to content

Commit

Permalink
Document rules: skip links which are not being rendered or in skipped…
Browse files Browse the repository at this point in the history
… contents

It's hard for the user to interact with these links, and the author may
not even intend them to be part of the document's palpable content.

In at least Chromium (and likely other implementations), these are also
elements where the author is trying to skip work related to selector
matching etc, which makes selector_matches applying to them particularly
problematic. Better to ignore them altogether.

Fixes #246.
  • Loading branch information
jeremyroman authored Nov 23, 2023
1 parent 18ea600 commit 5c49115
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions speculation-rules.bs
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,9 @@ A <dfn>prerender candidate</dfn> is a [=struct=] with the following [=struct/ite

<div class="note">This corresponds to the elements which match '':any-link'' [=pseudo-class=], or which appear in the {{Document/links}} collection.</div>

1. If |descendant| is not [=being rendered=] or is part of [=skipped contents=], [=iteration/continue=].

<div class="note">Such links, though present in the document, aren't available for the user to interact with and are unlikely to be good candidates. In addition, they may not have their style or layout computed, which might make CSS selector matching less efficient in user agents which skip some or all of that work for these elements.</div>
1. Let |url| be |descendant|'s [=HTMLHyperlinkElementUtils/url=].
1. If |url| is null, or its [=url/scheme=] is not an [=HTTP(S) scheme=], [=iteration/continue=].
1. If |predicate| [=document rule predicate/matches=] |descendant|, then [=list/append=] |descendant| to |links|.
Expand Down

0 comments on commit 5c49115

Please sign in to comment.