Situation: several developers working remotely on different section/modules of a SPA.
As a result they may accidentally introduce HTML elements with the same id
. W
I would prefer to see ids used only to specify modules, widgets, main sections etc. This will lead less id's in general and most of your naming to be created by your business logic. You also end up structuring your classes & tags with a sort of localised hierarchy like: #specialWidget h3 {} #specialWidget p {}
and you just select your handlers like - $('#specialWidget .some-btn').click()
and never like $('#someBtn').click()
because it just get's messy and too specific.
Past that, testing and continuous integration are your best bet to catch things like this.