Skip to content

Instantly share code, notes, and snippets.

@andreascarpello
Created October 28, 2013 14:42
Show Gist options
  • Save andreascarpello/7197882 to your computer and use it in GitHub Desktop.
Save andreascarpello/7197882 to your computer and use it in GitHub Desktop.
(function findDuplicateIds() {
var ids = {};
var all = document.all || document.getElementsByTagName("*");
for (var i = 0, l = all.length; i < l; i++) {
var id = all[i].id;
if (id) {
if (ids[id]) {
console.log("Duplicate id: #" + id);
} else {
ids[id] = 1;
}
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment