Last active
March 30, 2020 15:41
-
-
Save AutoSponge/72af49ba54aa47dbacdd3fd93b7d9d65 to your computer and use it in GitHub Desktop.
finds duplicate dom ids
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
Array.from(document.querySelectorAll('[id]')).reduce((cache, el) => { | |
const els = cache[el.id] || []; | |
cache[el.id] = els.concat(el); | |
return cache; | |
}, {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment