I learned that nesting anchor tags is not standards compliant HTML.
From W3:
Links and anchors defined by the A element must not be nested; an A element must not contain any other A elements.
Since the DTD defines the LINK element to be empty, LINK elements may not be nested either.
It would seem like alternatives such as those suggested in the selected answer in this question would have more of a chance of creating unexpected behavior than simply nesting the anchors would!
It also seems like overkill to make onclick event handlers just to redirect the page in JS. Not to mention using a script solution would cause problems for users browsing with scripts disabled.
EDIT
What is interesting was that I was working on a fiddle to demonstrate and I had overlooked that chrome was actually restructuring the DOM as such:
<div id="container">
<a href="http://yahoo.com"></a>
<div class="parent">
<a href="http://yahoo.com">Parent Element</a>
<a href="http://google.com">
<div class="child">Child Element</div>
</a>
<a href="http://bing.com">
<div class="child">Other Child</div>
</a>
</div>
</div>
I overlooked this because I saw the hover working and had my mouse on the text. Knowing this now doesn't necessarily change my question, but it sure does illustrate that it doesn't even work the way I thought.
#
href attributes... So it has something to do more than with just HTML, I'm sure. – Joyner<a>
elements, in a backward compatible way. – Anaphylaxis<a>
tag doesn't stop the propagation of theclick
event, so all the<a>
(and any other tags) in the parents list would get the click event, thus undefined behaviour. – Lucchesi