W3C home > Mailing lists > Public > public-xhtml2@w3.org > May 2009

value for class attribute should be CDATA (not NMTOKENS)

From: Michael(tm) Smith <mike@w3.org>
Date: Tue, 26 May 2009 13:18:27 +0900
To: www-html-editor@w3.org, public-xhtml2@w3.org
Message-ID: <20090526041824.GB13811@sideshowbarker>
A document containing an element which has a class attribute with
an empty value (for example, <div class="">) is valid in XHTML 1.0
(and in HTML 4.01), but it seems like the XHTML 1.1 specification
redefines the value of the class attribute in such a way that it's
no longer valid in XHTML 1.1

For the record, here are the details:

In the XHTML Common Attribute Definitions section[1] of the XHTML
Modularization 1.1 specification, the value of the class attribute
is defined as NMTOKENS:

[1] http://www.w3.org/TR/2008/REC-xhtml-modularization-20081008/dtd_module_defs.html#a_module_XHTML_Common_Attribute_Definitions

But in the XHTML 1.0 DTDs (and in HTML 4.01), the value of the
class attribute is defined[2] as CDATA:

[2] http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-strict.dtd_coreattrs

This seems to be a substantive change, but it's not documented in
the Changes from XHTML 1.0 Strict section[3] of the XHTML 1.1
specification, http://www.w3.org/TR/xhtml11/changes.html -- and
I've not so far been able to find any record of an announcement
about that change (nor any record of discussion about it at all).

Anyway, I note that the XML spec defines NMTOKENS as a space-
separated list of one or more NMTOKEN, and each NMTOKEN must be
one or more name characters, http://www.w3.org/TR/xml/#NT-Nmtoken

  Nmtokens ::=  Nmtoken (#x20 Nmtoken)*
  Nmtoken  ::=  (NameChar)+

So as far as I can see from that, any attribute whose value is
defined as NMTOKENS must not be empty. So by redefining the value
of the class attribute from CDATA to NMTOKENS, the XHTML 1.1
specification introduces a change that's not backward compatible
with existing XHTML 1.0 content -- a change that'll cause users to
find that their existing XHTML 1.0-valid documents containing
empty class attributes are no longer considered valid in XHTML 1.1

  --Mike

-- 
Michael(tm) Smith
http://people.w3.org/mike/
Received on Tuesday, 26 May 2009 04:18:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 23 February 2010 18:12:53 GMT