Random HTML thoughts

Small thoughts of mine this afternoon.

HREF on any element
One of the planned changes for XHTML 2 was to allows href to be an attribute for any element, not just <a>. It’s not that huge a change, indeed backwards compatibility could be forced using javascript. Since it doesn’t face the same technical challenges as other HTML 5 adjustments I wonder why it didn’t make it into HTML 5.

Where’s my default inline block container?
<div> is display: block by default. <span> is display: inline by default. Where’s the default inline-block element? Also, I feel each major display type should have a corresponding element. <grid> for display: grid, <flex> for display: flex and so on. As for inline block - I’d vote for <IB> as its default container.

Canary Mode
Browsers will try to render anything. What if they didn’t? I’d love it if I could get Chrome or Firefox to cease rendering on an error when testing my own pages. Never would be able to turn it on to browse the net at large because most pages have invalid markup, but it would be nice if browsers would at least help you learn standards instead of helpfully rendering everything thrown at them.

As for “Canary” well-formed constrains of XHTML when served as ‘application/xhtml+xml’ media type would be something close. Though basically “Canary” will never happen as a default setting because the browser manufacturers dare not for fear of losing users and they’d be a huge backlash from those that wrote less than something, which resembled HTML and legacy code. There are already some browser based debugging tools or lints. Though I agree in part, in a “ideal world” it would be nice if shoddily coded pages triggered a ‘browser warning message’ saying; this webmaster’s code sucks, etc. :slight_smile:

HTML5 seem to have strange a life of it’s own… so I suspect they chose the easiest path and decided most modern browser ‘in the wild’ already will render anchor elements so didn’t progress and hence why they choose the less sensible option.

[font=verdana]

As <a> is now allowed to wrap any elements rather than only inline elements and text, this is no longer such a big deal.

One thought is that it may be harder to detect illegally nested links if you had href on arbitrary elements … in other words, would validators pick up on

<p href="/home.htm">On our home page you can read all <a href="/about.htm">about our company</a>!</p>

If you said that any contained links effectively outranked parent links (ie, clicking on “about our company” would activate the about.htm link instead of the home.htm link, you would open the door to lots of scope for googleabuse with nested links that never appear in the output.

You would also have a whole lot more CSS to write if you had to code for every possible element with [href] or :link (etc) attributes, whereas when it’s <a> it’s a whole lot easier to deal with.

There are quite a number of issues, and I’m really not convinced that the benefits stack up.

Where’s my default inline block container?
<div> is display: block by default. <span> is display: inline by default. Where’s the default inline-block element? Also, I feel each major display type should have a corresponding element. <grid> for display: grid, <flex> for display: flex and so on. As for inline block - I’d vote for <IB> as its default container.

There’s no need for a default inline-block container. Inline-block content is usually block content, so you just use a <div> and apply display:inline-block; in the CSS. The fact that it is inline-block is just a rendering trick, in the same way as floating or positioning an element, but we don’t have (and don’t need) HTML elements for those.

Canary Mode
Browsers will try to render anything. What if they didn’t? I’d love it if I could get Chrome or Firefox to cease rendering on an error when testing my own pages. Never would be able to turn it on to browse the net at large because most pages have invalid markup, but it would be nice if browsers would at least help you learn standards instead of helpfully rendering everything thrown at them.

Yes, it would be nice – maybe if you suggest it to the open source community or to Opera they may be able to build it into a future version! Of course, running your pages through the validator is a pretty easy way to check (and Opera certainly makes this very easy, just right-click on the page and Validate is there on the context menu!) or, as Robert says, you could run them as XHTML.[/font]

HREF on any element

Can’t wait to watch developers destroy that one.

Where’s my default inline block container?

Inputs. Depending on the browser.

Canary Mode

Yeah XML kicks butt in that regard. Draconian parsing FTW.

*note: first response is a sort of sarcasm. Last one is totally straight.

You wouldn’t have been able to do that in XHTML 2 as that markup language doesn’t have an <a> tag.

Anyway, How would that be more difficult to detect than:

<a href="/home.htm"><p>On our home page you can read all <a href="/about.htm">about our company</a>!</p></a>

In both cases there is an href attribute nested inside another tag that also has an href attribute - testing by the attribute is the way browsers would need to do it now since nesting <a> tags doesn’t cause a problem if the inner one doesn’t have that attribute.

<a href="/home.htm"><p>On our home page you can read all <a id="about">about our company</a>!</p></a>

<a href="#about">company?</a>

As for Canary Mode it is really unfortunate that IE9 still attempts to render XHTML even after finding an error in the page and without reporting the error. At least the other browsers report the error at the spot they decided that it occurred (for example: open tag that wasn’t closed in some browsers, where the close tag is identified as missing in other browsers) before possibly displaying the rest of the page content. Of course it still isn’t practical to use XHTML since IE8 is still used by too many people to ignore and that browser will offer the page for download as it doesn’t understand XHTML. That browser should be long dead by the time that the HTML5/XHTML5 standards are finalized so at that time you will have the choice of whether tho use HTML5 and have the browsers ignore the errors or use XHTML5 and have some browsers report the errors.

As <a> is now allowed to wrap any elements rather than only inline elements and text, this is no longer such a big deal.
I am torn on this one. I predict people ( amateurs and possibly desperate developers) will start nesting links… how does a UA handle that?

eg.:


<a href="bbb.html"><div>
<p>Lorem ipsum <li><a href="aaa.html">dolor</li>							 sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div></a>

OH… and they will wrap As around LIs…

Either way, there will be chaos

No. The HTML parser closes open <a> elements when seeing a new <a> tag without caring about the attributes.

You can end up with nested links in XML and with scripts and even with HTML if you’re creative (e.g. <a><table><a>), and it hasn’t caused chaos from what I can tell. http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2095

That’s the problem with the tag having two completely opposite meanings that wouldn’t conflict if the browsers were testing on the essential difference - the href attribute. Basically you are saying that the browsers are not testing the right thing now and that’s why it would be harder than it ought to be to drop the <a> tag.

I have a Canary :slight_smile:

Well actually it is a Firefox Addon that was created August 2007, has been revised extensively and works just like a Canary.

The unobtrusive addon works in the background and immediately after Firefox renders the page one of three icons appear on right of the toolbar. Icons are red, orange and green indicatiing errors, warnings or successful validation repectively. Clicking on the icon pops up a window split into three resizable forms showing source, list of errors and suggestions on fixing the errors.

http://users.skynet.be/mgueury/mozilla/index.html

Bah. I want my Canary to scream murder and explode into flames and rm -rf my system and set fire to the world when it sees I’ve accidentally a tag. Not squeak some little button in a corner far far away.

I’ve sure it’s raised rates of death-by-bus by .00006% though. Next step is, of course, world domination.

THE NEW ONE-WORLD GOVERNMENT SHALL BE KNOWN AS HIXONIA