[whatwg] Make quoted attributes a conformance criterion

Michael Kozakewich mkozakewich at icosidodecahedron.com
Sat Jul 25 22:54:25 PDT 2009


From: "Mike Shaver" <mike.shaver at gmail.com>
Sent: Saturday, July 25, 2009 11:56 PM
To: "Keryx Web" <webmaster at keryx.se>
Cc: <whatwg at lists.whatwg.org>
Subject: Re: [whatwg] Make quoted attributes a conformance criterion

> On Sat, Jul 25, 2009 at 5:47 AM, Keryx Web<webmaster at keryx.se> wrote:
>> I think my suggestion is totally analogous to e.g. semi-colon insertion 
>> in
>> ECMAScript. JSLint demands that those should be present, and I've yet to
>> hear anyone say "it's a matter of style". Omitting semi-colons is a known
>> cause of trouble in ECMAScript.
>
> And yet, tons of inline event handler attribute values on the web omit
> their trailing semicolons...as a matter of style.
>
> Mike

As someone with an eye for language, I can say that's not really a matter of 
style. We'll drop the final semicolon in inline JavaScript because we all 
know it's never necessary, no matter the situation.
It's true that these ideas do make themselves at home. What most people 
don't seem to grasp, however, is that it has everything to do with how they 
learned the language. The human mind is a very adaptable and intuitive 
thing, and it tries hard to optimize. If a language doesn't require that 
something exists, most people will skip it. This can lead to a very degraded 
language, such as the type of English you see in chat channels, as well as 
something simpler, like the absence of quotes in HTML.

As well, you'll never find habitual omission of quotes from programmers of 
most other languages, because they're required -- HTML is an odd man out. 
It's made this way to be easier for most people to learn and use, but it 
takes up a greater amount of browser overhead and still leaves some errors.

The root of the problem is this: Requiring quotes, especially after all 
these people have learned about HTML and have learned to code without 
quotes, isn't backwards-compatible. Browsers already use their resources to 
parse bad code, and so it's also too late to try forcing well-formedness on 
those.
At the same time, quotes -- if the writers learn to always quote without 
thought -- decrease errors and also normalize the language.
The only answer, then, is to deprecate not-quoting: Add quotes to the spec 
examples, state that quotes aren't needed but are best-practice, add 
'unquoted' warnings to the validator, and teach new web developers to always 
quote attributes.

In the future, we might be able to resurrect this debate with more 
usefulness. Until then, our options are to either do the above or leave it 
as it is. Adding quotes is more sustainable in the long run, unless it's 
shown that coders really do have a hard time learning it. HTML must stay 
easy, above all (most) else. (I argue that quoting all the time is easier 
than never quoting, but you're really have to ask the students.) 




More information about the whatwg mailing list