Frontend Questions
- Why assigning too many ids to html elements is not a good practice? Ref
Elements with id will be global variables and properties on
window
object.- This leads to more bugs, like if there’s a
var
with the same name of anid
of a DOM node.
- This leads to more bugs, like if there’s a
If there’s a built-in global property or property of
window
with the same name as theid
of some DOM node, it will not be overriden by theid
attribute.Example:
1 | <html> |
2.
Frontend Questions