The attribute has no effect but it does have a variety of important roles.
- Fragment anchor … The element can be hooked with a link
- Higher importance … id has specificity
0 1 0 0
- Unique selector … Styles can be confined to one fragment
- Unique node … Script can listen for events on single element node
Like everything else in HTML, need is the driver of design. If there is no need for it, then don’t use it.
From a coding perspective, line number bookmarks are usually available in most text editors, but searching for hooks in the code is a time saver. Can’t really say I’ve ever relied on that approach but it does have some value.