Created
August 31, 2021 08:30
-
-
Save nucliweb/72923d1f19b72415b1d5584ce0625043 to your computer and use it in GitHub Desktop.
Snippet to list the link elements with some web performance "rel" attribute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rels = ['preload', 'prefetch', 'preconnect', 'dns-prefetch', 'prerender', 'modulepreload'] | |
rels.forEach(element => { | |
const linkElements = document.querySelectorAll(`link[rel="${element}"]`) | |
const dot = linkElements.length > 0 ? '🟩' : '🟥' | |
console.log(`${dot} ${element}`) | |
linkElements.forEach(el => console.log(el)) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment