99 points · by onderhond · 13y ago · 72 comments
If your concept is that blocks of design should do things when clicked, that idea is valid. Thankfully, we have methods for easily capturing click events on arbitrary and nested blocks--in fact a whole language for handling events across the representation of layout.
Meanwhile, hyperlinks were for terms in hypertext, and A are the anchors around terms, helping you make a TOC and Index within a single document. The semantic meaning of A is, "this is a term" and A HREF is "this term conceptually relates to this other hypertext reference".
Nobody's forcing you to overload that very simple concept, and certainly nobody's forcing you to wrap headers and footers and main divs inside an anchor. I feel that your application of the anchor is broken.
Except that images have been linkable since forever, and they are not really "terms in hypertext". Once you start allowing other items than text inside your anchored reference, you have to accept that the relations may become more complicated than a simple, single graph edge. The reference content may in fact be a block quote with a deeper nested reference within itself... and so on.
Images are text, at the academic level that hypertext was originally conceived. That's why it makes sense to click and drag an image into Google search, and why it doesn't make sense to do the same to a random div.
Going back to the img example: What if I want a navbar? The semantically linked thing is not a random div, it is the whole button area, not just it's text. What if it contains a "help with this option" icon with in the area, that is semantically different from it's surrounding button?
The argument is that if an image is "text", then other elements that aren't just words, can in fact be "text", because they have semantic value.
While I agree block-linking seems like an odd way to implement the desired functionality, the idea that javascript (did you mean javascript?) is a more suitable alternative is dubious.
The concept of requiring an entire engine to enable linking from HTML elements just seems dirty, when it could be achieved so much more simply with a universal href tag. For starters, how would one define link targets?
I thought that was a brilliant idea. For link on block but also for common pattern such as the infinite <li><a href="">…</a></li> that we see everywhere and which lead to confusion (which parts of the style should be applied to <li> elements, which parts to the <a>?).
I really don't know why W3C didn't keep this idea in HTML5.
<img src="pic.jpg" href="about.html">
Doesn't that just look cleaner? Shame it won't change until something radical supersedes HTML. <img src="pic.jpg" data-href="about.html">
And this, plus what I suspect it would be a very tiny global javascript handler that takes care of simulating the links, would pretty much do it.Of course, there is the question of how well this would work on older browsers, although actually as long as javascript is not disabled I don't think it would give much trouble (data attributes can be easily fetched in IE6 for instance)
Edit: Here's a quick and dirty demo of how this could work: http://jsfiddle.net/Dszvc/2/ it could easily be turned into a full featured plugin.
<img src="pic.jpg" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="about.html" />
I know they index SVG documents, and there’s no @href in SVG namespace… Would that work for (X)HTML5 documents, either served as HTML or XML document?You’d still need JS polyfill, but at least the semantics remain intact.
Either way, I think href should be a universal attribute (obviously, it wouldn't make sense on something like br). It offers a lot of flexibility and is probably no more subject to abuse than anything else. I don't see how browsers would have a problem implementing it. Just look at the 3D view of a complex page in the Firefox Inspector to get an idea of what they're already coping with.
----------
- Person
- Thumbnail
- Name
- URI
- Posts by person (URI)
----------
- Post
- Title
- URI
- Author (URI)
----------
You might say the entire person block could have a reference to it's URI. But more important is the posts by person anchor, and the related author anchor. They are the anchor points from which you leave each document.
Sure, you could add that functionality to other blocks, but they would already have other semantic meaning. Like a list item with a reference is still just a list item.
This tag is semantically its own.
One could make the same argument about any semantic tag for inline content. Like `em` or `strong`. You could of course indicate emphasis of an entire list item using a CSS class, but it's still just a list item. And the ability to use emphasis on other tags does not negate the need for an `em` tag for just that purpose.
I know you might ask what about graceful degradation?, but the truth is our app relies heavily on javascript (websockets) to work, as 90% of modern apps/sites do, so we decided to ignore it. We don't like that, but something's got to give.
Users with JS get <tr data-href=""><td><a href="">Content</a></td></tr>, with JS doing as in your example.
The downside is that we'd have to repeat ourselves, but at least the system will degrade somewhat-gracefully.
ad-supported: true|false,
requires-free-registration: true|false,
behind-paywall: true|false. :-)In the meantime, someone could write a Chrome plugin that uses a blacklist to rewrite links to paywalled sites.
Yes, but they have no real incentive to put them there, since they want people to see the paywall (and possibly subscribe). Besides, many paywalls are dependent on the user (e.g. she may have some free views per month or so).
- it allows to have multiple links for an element.
- you can add information about the linked resource like semantic relation with the current context (rel or rev), content type of the link, language ...
Maybe it would be nice to have the following behavior: when you have a anchor tag without a closing tag it would mean that the anchor context is the parent element.
It's actually unfortunate that in so many cases where people wrap blocks with anchors, they go for the inner-wrap method which has a major downside in that the inner anchor does not span the entire block by default. That means that there are a lot of, say, logos that have padding you can't click on (contrast with the horrible ads that have clickable whitespace).
Of course, you could just give a visual feedback of what is the current link that will be followed but that might be annoying to some depending on the design.
<ul href="http://example.com/examples/">
<li href="1">Example 1</li> <!-- http://example.com/examples/1 -->
<li href="/foo/bar">Foo Bar</li> <!-- http://example.com/foo/bar -->
<li href="http://example2.com">Other examples</li> <!-- http://example2.com/ -->
</ul>As ever, people are the great blockers to any implementation :-)
This bit piqued my interest, so I made this: https://bitly.com/13F3dIy
I find the anchor tag a limitation, whereas an href attribute allows for much more freedom without resorting to using Javascript. Well, in theory; in practice you would need a shim for older browsers.