3 ms·
IIRC, in one of the early draft of HTML5, the <a> tag was there for retrocompatibilty but was deprecated, and href was a valid attribute for all HTML5 tags in <
by p4bl0 14y ago
IIRC, in one of the early draft of HTML5, the <a> tag was there for retrocompatibilty but was deprecated, and href was a valid attribute for all HTML5 tags in <body> and its children.
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.
- lucian1900 14y agoProbably because too much would get broken. That is sadly very often the (even more sadly, correct) argument against doing things right.
- p4bl0 14y agoIf the change is only to allow the href attribute on any tag, how would that break anything?
- hatu 14y agoOlder browsers might go crazy
- DoubleMalt 14y agoWho cares? If you use HTML5 you have to throw them under the bus anyway. And most (older) browsers ignore unknown attributes anyway.
- UnoriginalGuy 14y agoHTML5 in general degrades fairly well, with the exception of with browsers which simply don't support CSS at all (e.g. IE5 and below). You're right to say that older browsers would ignore the unknown attribute, the problem is that having links broken might degrade that site to a point where it isn't usable.
- DoubleMalt 14y agoBut it would be pretty easy to create a polyfill that attaches onclick handlers to the respective elements. Actually I'm tempted to write one to get this functionality with current browsers. [edit] As Oscar Wild put it: The only way of getting rid of a temptation is to yield to it. https://github.com/webcrofting/href4all https://github.com/webcrofting/href4all
- Torrents 14y agoThat's awesome! From concept to github in a flash. Well done.
- rsanders 14y agoThis would be a pretty easy thing to polyfill, I think.
- mathias 14y agoYou may want to read up on HTML Design Principles: <http://www.w3.org/TR/html-design-principles/> http://www.w3.org/TR/html-design-principles/>.
- olavk 14y agoSemantics are non-obvious with href on a lot of elements like tr/td/form/input/textarea/button/head/script/style for example. A lot of work would go into specifying and implementing the interactions of combinations of href on table/colgroup/tbody/tr/td for example - for no significant benefit.