Re: Anomaly that has been around since 2008/9

2012-10-08 16:53, Paul de Freitas wrote:

> The following generates an error – note that onload does not generate an
> error:
>
> <body class="megasolV3" onload="fillTheScreen();
> Shadowbox.init(options); externalLinks()" onresize="fillTheScreen()">

The reason is that onload is defined in XHTML 1.0, onresize is not. 
Technically, what matters is the Document Type Definition used, in this 
case the one listed at
http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Transitional

As the error explanation says:

> You have used the attribute named above in your document, but the
> document type you are using does not support that attribute for this
> element.

The onresize attribute is a Microsoft invention, now supported by most 
other browsers as well, but it isn't part of XHTML 1.0. It is being 
standardized in HTML5.

> Here is the URL of the document:
>
> http://www.megasol.se

The other validator error messages about it relate to features that are 
not valid in XHTML 1.0 but are valid in HTML5 (using <script> without 
type attribute and using data-* attributes). However, switching to an 
HTML5 doctype isn't that easy - contrary to popular misunderstandings, 
HTML5 is not a pure extension of HTML 4.01 and XHTML 1.0.

Something odd happens when I try to validate the page under HTML5, by 
just copying the source, pasting it into the textarea in "Validate by 
Direct Inpit" and then changing the doctype line to <!doctype HTML> 
before clicking on "Check". The fourth line, which is a comment, gets 
turned to

<!--<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/><!-- <meta http-equiv="Content-Type" content="text/html; 
charset=iso-8859-1" /> -->-->

which really messes things up. I think this is bug in the validator.

Anyway, if I remove that comment (it plays little role anyway) and 
validate as HTML5, there's a single error. So maybe you wish to consider 
switching to an HTML5 doctype, despite the in-progress nature of HTML5 
and the experimental nature of HTML5 validation.

(The single error is about rel="shadowbox;width=960;height=610" in an 
<a> tag. It passes XHTML 1.0 validation, which treats rel attributes as 
taking any value, but not HTML5 validation, which uses a list of allowed 
rel attributes. This particular value does not look like one that should 
even be registered rel value. Rather, it looks like something you could 
put into a data-* attribute.)

Yucca

Received on Thursday, 11 October 2012 10:01:02 UTC