[whatwg] Make quoted attributes a conformance criteria
simonp at opera.com
Mon Jul 27 02:10:05 PDT 2009
On Sat, 25 Jul 2009 12:08:23 +0200, Eduard Pascual <herenvardo at gmail.com>
> On Fri, Jul 24, 2009 at 9:52 PM, Keryx Web<webmaster at keryx.se> wrote:
>> On 2009-07-23 20:32, Eduard Pascual wrote:
>>> While I don't consider a hard requirement would be appropriate, there
>>> is an audience sector this discussion seems to be ignoring: Authoring
>>> Tools' developers. IMO, it would be highly desirable to have some
>>> guidelines for these tools to determine when they*should* quote
>>> attribute values.
>> There is one further rub. Code that initially has been made by authoring
>> tools have a tendency to wind up in some front end developers lap, to be
>> amended and/or fixed manually at a later stage. That is even more a
>> for a strong recommendation about quotes.
>> Furthermore, I doubt that most people on this list did read my blog
>> post I
>> included as an URL when starting this discussion.
> I can't speak for others, but I did read your post. And still I am
> convinced that a hard requirement to quote all values is not the best
> solution. There are some values that MUST be quoted, some that SHOULD
> be quoted, and even some that SHOULD NOT be quoted. Those that must be
> quoted are already covered by the spec, and validators will yield the
> relevant error message when encountering such values unquoted. For
> those values that *should* be quoted (those that improve in
> readability when quoted, or those that could lead to errors when they
> are later changed if unquoted), a warning from the validator should be
> enough. Finally, there are some values that are better unquoted, such
> as those attributes that can only take a number (there is no risk of
> errors, and the quotes would normally hurt readability more than they
> help it).
Actually boolean attributes are allowed to take the empty string as value,
and it's not allowed to leave the empty string unquoted. However, boolean
attributes aren't subject to the template/backend mismatch because you
have to omit the attribute altogether for the false value, so the backend
developer has to be responsible for writing out the whole attribute.
Therefore, it should be safe to leave boolean attributes unquoted.
It should be safe to leave any attribute in the minimized form, because it
also isn't subject to the template/backend mismatch.
Non-boolean attributes that are safe to leave unquoted:
<progress value max>
<meter value min low high max optimum>
<img width height>
<iframe width height>
<embed width height>
<object width height>
<video width height>
<canvas width height>
<area shape hreflang>
<td colspan rowspan>
<th colspan rowspan scope>
<form autocomplete enctype method>
<input autocomplete formenctype formmethod height max maxlength min size
step type width>
<button formenctype formmethod>
<textarea cols maxlength rows wrap>
Global non-boolean attributes that are safe to leave unquoted:
All other attributes can take one of the special characters [\s"'<>] in
the value, or the empty string as the value.
More information about the whatwg