Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiple link elements with rel=icon #76

Merged
merged 5 commits into from
Jul 21, 2020
Merged

Conversation

whymarrh
Copy link
Contributor

Extracted from #75

It is very possible—even recommended—that there are multiple icons and if we're going to check that they actually exist, we should fallback to the other images listed.

e.g.:

<link rel="icon" type="image/png" href="https://cdn.yourwebsite.com/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="https://cdn.yourwebsite.com/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.yourwebsite.com/favicon-96x96.png" sizes="96x96">

There is a subtle functionality change here in that the element matching head > link[rel="shortcut icon"] will no longer be checked first, but that isn't important, nor should it be. That said, not checking for rel="shortcut icon" first could also be an improvement since its usage isn't quite correct or modern:[1]

For historical reasons, the HTML specification now allows the use of shortcut as a link relation if it’s immediately followed by a single U+0020 space character and the icon keyword.

@whymarrh whymarrh requested a review from a team as a code owner July 21, 2020 19:09
It is very possible—even recommended—that there are multiple icons and if we're
going to check that they actually exist, we should fallback to the other images listed.

e.g.:

```html
<link rel="icon" type="image/png" href="https://cdn.yourwebsite.com/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="https://cdn.yourwebsite.com/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.yourwebsite.com/favicon-96x96.png" sizes="96x96">
```

There is a subtle functionality change here in that the element matching
`head > link[rel="shortcut icon"]` will no longer be checked first, but that
isn't important, nor should it be. That said, not checking for
`rel="shortcut icon"` first could also be an improvement since its usage isn't
quite correct or modern:<sup>[\[1\]][1]</sup>

> For [historical reasons][2], the HTML specification [now allows][3] the use
> of `shortcut` as a link relation if it’s immediately followed by a single
> U+0020 space character and the `icon` keyword.

  [1]:https://mathiasbynens.be/notes/rel-shortcut-icon
  [2]:https://www.w3.org/Bugs/Public/show_bug.cgi?id=12695
  [3]:https://html.spec.whatwg.org/multipage/semantics.html#rel-icon
rekmarks
rekmarks previously approved these changes Jul 21, 2020
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@whymarrh
Copy link
Contributor Author

Fixed up the JSDoc

@whymarrh
Copy link
Contributor Author

Fixed up the JSDoc, again 😅

@whymarrh whymarrh merged commit c6f01f3 into master Jul 21, 2020
@whymarrh whymarrh deleted the check-all-icons branch July 21, 2020 20:20
@whymarrh whymarrh mentioned this pull request Jul 21, 2020
@rekmarks rekmarks mentioned this pull request Jul 21, 2020
rekmarks added a commit that referenced this pull request Jul 21, 2020
* 6.1.0

* #72, #73, #76, #78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants