[whatwg] Make quoted attributes a conformance criteria

Keryx Web webmaster at keryx.se
Fri Jul 24 12:52:45 PDT 2009

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 
reason 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.[1]

In that post I talked about a common scenario. One developer works on 
the business logic. It puts out attribute values. Another developer 
works on the presentation logic. He makes templates. Dev 2 omits the 
quotes and for a long time it might work, since the business logic in 
question only produces single word values. Then there might come a 
change, because dev 1 - or the users of the CMS - suddenly starts to 
produce longer values. Suddenly things break, and since nobody touched 
the presentation logic code, it might not be the first place where the 
developers look for an error.

And believe me, lots of back end devs are absolutely clueless about 
front end issues! Yes, they might skip validation completely, but at 
least such a rule of thumb can be implemented more easily into their 
work flow.

I also note that no one who has spoken against my suggestion claims to 
have any teaching experience.

I see 4 effects that my suggestions might have:

1. Dismiss completely.

2. No new wording, but change the code examples.

3. Add some words about best practice, but do not enforce quotes as a 
conformance criterion.

4. Go all the way and do just that.

The scientific evidence in favor of my suggestion might be quite easy to 
pick up. Just ask any standards aware teacher how common it is that not 
using quotes messes up students code!

Stopping before (4) above will force people like me to keep requiring 
false XHTML from my students. My main concern is that in HTML 5 we get 
lots of new boolean attributes, like "required" on inputs or "maxlength" 
on textareas, and having to write things like 'required="required"' will 
make the code longer and messier, since a normal input element might 
span 2 or 3 lines.

Of course this can be settled if we get a tool like JSLint, that can 
enforce a voluntary stricter check (Crockford's "good parts"), but 
please note that ES 5 introduces a concept of "strict" rules.

This means that ES 5 will be in a similar position to HTML 5, having a 
lax rule set about what browsers must be able to do, and a strict 
"conformance critera" like rule set that authors are encouraged to follow.

Perhaps this could be solved by simply adding an option to the 
validator: "Do not allow unquoted non-boolean attribute values".

Henri Sivonen, are you reading this?

Keryx Web (Lars Gunther)

1. http://itpastorn.blogspot.com/2009/07/value-of-false-xhtml.html

More information about the whatwg mailing list