These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:15 pm Advanced search

Nested anchors

Do you think the HTML spec should do something differently? You can discuss spec feedback here, but you should send it to the WHATWG mailing list or file a bug in the W3C bugzilla for it to be considered.

Nested anchors

Postby valkyr » Fri Mar 05, 2010 9:41 pm

Why not?

I know Firefox at least doesn't currently work as expected, but I don't see why allowing nested anchors would be a problem if they were implemented correctly in user agents, i.e. clicking a nested link takes you to that link address, while clicking any part of the parent anchor takes you to its' address.

Code: Select all
<a href="http://www.htmlinfo.com">More on <a href="http://w3.org/html">HTML5</a></a>


Opinions?
valkyr
<h5>
 
Posts: 16
Joined: Sun Oct 18, 2009 1:30 am

Postby JAB Creations » Fri Mar 05, 2010 10:00 pm

Nesting anchors would be like trying to tell someone in a car that the left side of their car can go to California and the right side of the car can go to New York. There is no reason or even potential I see for trying to do this.
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Postby lyosha » Sat Mar 06, 2010 4:01 am

Or that there's a car inside a car and both of these cars can go different places while one still remains inside the other. o_0
lyosha
<h3>
 
Posts: 60
Joined: Fri Aug 22, 2008 9:26 pm

Postby valkyr » Sun Mar 07, 2010 5:13 pm

I understand the problem, but it seems the only possible way of marking such a link up.

Take the following...

Code: Select all
<a href="http://guidetowindows.com">Read up on <a href="http://microsoft.com/windows"><a href="http://microsoft.com">Microsoft</a> Windows</a>
</a>


How else would you propose to markup such (hypothetical) links?

You could say to markup each part separately, but that wouldn't be semantically correct. You'd end up with a link :

Code: Select all
<a href="http://guidetowindows.com">Read up on</a>


Read up on what?

Event-bubbling works for other events, so why not standard links? - With proper user-agent support, the browser would know specifically which link the pointer was hovering over. Firefox already does, the problem comes when actually clicking - then focus is always given to the parent link.
valkyr
<h5>
 
Posts: 16
Joined: Sun Oct 18, 2009 1:30 am

Postby JAB Creations » Sun Mar 07, 2010 7:07 pm

Read about [ Microsoft ] [Windows ] with [ tutorials ].

I understand what you're doing though language does not work like that.
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Re: Nested anchors

Postby zcorpan » Mon Mar 08, 2010 12:16 pm

valkyr wrote:Why not?

That's the wrong question. The right question is why. What problem are you trying to solve? What's the use case?

Having a run of text look like a link but depending on where you click you go to different places seems like a horrible user experience.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Re: Nested Anchor tags

Postby CACoon » Fri Mar 26, 2010 3:40 am

I thought I'd throw this out as an example of a scenario where nesting anchor tags could be useful. I just ran in to this issue while trying to build a design hack for a proprietary .NET CMS.

I ended up with code that looks like:
<a href="site1"><div class="wrapper" height="300px" width="300px"><a href="site2"><img src="img.jpg" height="10px" width="30px" /></a></div></a>

However Firefox doesn't recognize the link to site1, it only sees the link around the image.

Due to the difference in scale between the two links this is less like trying to sell someone a car that goes two separate places at once, and more like trying to get someone to ride in a car going south while the continental plate moves north.

As for solutions: I'd rather not fill the outer div with an invisible image and wrap the anchor tag around that. but I'm running out of inventive ideas. Any suggestions?
CACoon
<h6>
 
Posts: 1
Joined: Fri Mar 26, 2010 3:16 am

Postby lyosha » Fri Mar 26, 2010 7:01 am

Since when did the div element even have height and width attributes? Whatever you're doing there doesn't look quite right to me.

If you really want an image that is a link on top of another link, you can easily position it that way with CSS.

There has still not been posted a truly valid use case for doing this, and unless one is posted, I doubt this will be seriously considered.
lyosha
<h3>
 
Posts: 60
Joined: Fri Aug 22, 2008 9:26 pm


Return to Feedback on the Specs

Who is online

Users browsing this forum: No registered users and 0 guests