Skip to content

Instantly share code, notes, and snippets.

@dkordik
Created January 21, 2013 21:29
Show Gist options
  • Save dkordik/4589609 to your computer and use it in GitHub Desktop.
Save dkordik/4589609 to your computer and use it in GitHub Desktop.
Smoke test for dupe CSS IDs
var dupeIds = [], dupeIdsString;
$('[id]').each(function(){
var ids = $('[id="' + this.id + '"]');
if (ids.length > 1 && ids[0] == this) {
dupeIds.push(this.id);
}
});
dupeIdsString = dupeIds.concat(", ");
equal(dupeIdsString, "", "All CSS IDs are unique");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment