Re: To fix syntax errors of HTML files

David Dorward wrote:

> olivier Thereaux wrote:
>
>>> -<meta http-equiv="Content-Script-Type"
>>> content="text/javascript" /> is required.
>>
>> As far as I know those are SHOULDs, not requirements. And since the
>> markup used specifies type="" in attributes for <style> and <script>
>> I think we're fine.
>
> It only applies to intrinsic event attributes, such as onclick.

I can't understand why this is discussed in the css-validator list, but 
anyway...

While the HTML 4.01 specification, in clause 18.2.2, says that authors 
"should specify the default scripting language for all scripts in a document 
by including [a certain] META declaration", it says before that: "As HTML 
does not rely on a specific scripting language, document authors must 
explicitly tell user agents the language of each script."

Thus, the specification imposes a requirement ("must") on using the meta tag 
whenever event attributes are used. One might argue that the meta tag is not 
needed when an HTTP header is used for the purpose, but it's not part of a 
document, is it?

Of course, this is just futile theory, since browsers imply (some version 
of) JavaScript anyway. I'm niot sure whether they care about those meta tags 
or HTTP headers at all...

>>> -width and height is required for <img>.
>>
>> Could you give details as to where and why?
>
> They aren't, but they are recommended so browsers can put placeholders
> in while downloading images - this avoids reflow issues.

On the other hand, on some popular browsers, those attributes may cause the 
alt="..." attribute value to be badly truncated, if the image is small.

>>> -<p></p> is not recommended.
>>
>> Ditto. Could you give details as to where and why?
>
> Can "nothing" be considered a paragraph?

In any case, <p></p> is explicitly disrecommended in HTML 4.01, clause 
9.3.1:
"We discourage authors from using empty P elements. User agents should 
ignore empty P elements."

That statement has a CSS implication, but only in theory. The statement 
implies that browsers should act as if <p></p> were not there, even if CSS 
is used to create special spacing, to add generated content, etc. But this 
too is just theory, since browsers do not follow the recommendation

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 

Received on Friday, 6 February 2009 18:17:26 UTC