On Dec 1, 2009, at 7:05 PM, Tony Mechelynck wrote:

> On 06/11/09 17:50, Ben Fritz wrote:
>>
>> On Nov 6, 10:34 am, Ben Fritz<fritzophre...@gmail.com>  wrote:
>>> Incidentally, your example html may need some attention. Have you
>>> validated your markup? I don't remember if html requires it, but at
>>> the very least it's good practice (and required by xhtml) to quote  
>>> all
>>> your attribute values, like this:
>>>
>>> <tr><td><code><a "href=http://www.somesite.com/directoy";
>>> style="text-decoration:none">description</a>
>>> </code></td><td>quanity</td></tr>
>>
>> Whoops, like this:
>>
>> <tr><td><code><a href="http://www.somesite.com/directoy";
>> style="text-decoration:none">description</a>
>> </code></td><td>quanity</td></tr>
>
> In non-X HTML, quotes are not necessary unless you want to include
> spaces etc.

But they're ALWAYS advisable, or you can run into some *very* hard-
to-diagnose bugs.

This page <http://www.cs.tut.fi/~jkorpela/qattr.html> tells why. For
example, the following chunk of HTML validates, even though it is
manifestly wrong:

<a href=../test/abug.html>
<img alt="Yucca" src=../yucca.gif aling=right></a>
<a href=foo.html>bar</a>

More amazing, the fact that it validates is _not_ a bug in the
validator, but is because of the little-known "SHORTTAG" feature of
HTML, which (if it was supported *at all* in browsers) would allow
you to write this:

<em/foo/ instead of <em>foo</em>

It's kind of the ultimate version of self-closing tags.

As a result of it, the little chunk of HTML above, in the eyes of
the validator (which, because it is NOT a browser, so it follows
ALL of the arcane rules of HTML), is equivalent to this:

<a href=..>test</a>abug.html>
<img alt="Yucca" src=..>yucca.gif aling=right>
<a href=foo.html>bar</a>

Which is clearly not what was intended. Quoting the attributes would
have allowed the validator to notice that the "align" attribute is
misspelled.

Bottom line: quote your attributes. The time you save leaving out
the quotes won't be worth it.

Dave

-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to