Created
June 29, 2020 18:04
-
-
Save iamandrewluca/7a9a192179b563a9d45aca69c82f3192 to your computer and use it in GitHub Desktop.
Will search and mark duplicated IDs on a page #bookmarklet
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
javascript: void ((function() { | |
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */ | |
document.querySelectorAll('[id]').forEach(el => { | |
const specificIds = document.querySelectorAll(`[id="${el.id}"]`); | |
if (specificIds.length > 1 && specificIds[0] === el) { | |
console.log('Duplicate id ' + el.id); | |
specificIds.forEach(element => { | |
element.style.outline = '5px solid red'; | |
}); | |
alert('duplicate found'); | |
} | |
}); | |
})()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment