Is there a good practice or advice/requirement that every HTML element has an id or/and class specified (Including elements that wouldn't be accessed from JavaScript, for example)?
I would say that it is not necessary for these attributes to be present, but I see a number of situations when there might be a requirement to do that.
For example, another developer wants to extend the functionality of the site without changing the layout or the content - just extending existing/replacing JavaScript (or supplying the plugin, without even knowing the HTML of the final page).
I can see such a scenario in developing reusable components, for example, where an author of the component can't foresee all the use cases upfront but wants to protect himself from constant bug fixing after the release.
Another benefit would be the readability of the final HTML. I learn from reading the rendered HTML more than from more formal reading. A meaningful id often helps.
It would be nice to have an opinion of an experienced web developer or an reference to some guide lines/best practices.