NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 494 - Empty class is marked as invalid
Empty class is marked as invalid
Status: RESOLVED FIXED
Product: Validator.nu
Classification: Unclassified
Component: XHTML 1.0 schema
HEAD
All All
: P2 normal
Assigned To: Michael[tm] Smith
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-25 14:02 CEST by Geoffrey Sneddon
Modified: 2009-05-01 04:36 CEST (History)
1 user (show)

See Also:


Attachments
patch with proposed change (410 bytes, patch)
2009-04-25 16:23 CEST, Michael[tm] Smith
Details
updated patch (485 bytes, patch)
2009-04-25 16:32 CEST, Michael[tm] Smith
Details
updated patch (464 bytes, patch)
2009-04-30 04:24 CEST, Michael[tm] Smith
Details
updated patch (522 bytes, patch)
2009-04-30 04:29 CEST, Michael[tm] Smith
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Sneddon 2009-04-25 14:02:48 CEST
Yet empty classes are valid (just nonsense). Sample:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<title></title>
<p class="">
Comment 1 Michael[tm] Smith 2009-04-25 16:23:48 CEST
Created attachment 85 [details]
patch with proposed change

This patch sets the allowed value of the class attribute in the whattf XHTML10 schema to a list of zero or more xsd:NMTOKENS (it was set to one or more). That technically matches the HTML4 and XHTML1.0 specs (modulo the ambiguity that those specs don't clearly say whether the class value can actually be empty), but HTML4 and XHTML1.0 DTDs actually use CDATA as the allowed value for class. So if we wanted to match actual practice, the whattf XHTML10 schema should instead just set the allowed value to the text.datatype pattern (which is defined as "text").
Comment 2 Michael[tm] Smith 2009-04-25 16:32:13 CEST
Created attachment 86 [details]
updated patch

just cd'ed up to my base validator dir and ran diff from there so that it would should the full path to the file (to make it clear where the change is)
Comment 3 Henri Sivonen 2009-04-29 18:23:29 CEST
The quantifier inside the comment should be +. Other than that, look better than what's in currently, but is there any spec basis even for nmtokens of any number as opposed to any string?
Comment 4 Geoffrey Sneddon 2009-04-29 18:39:59 CEST
XHTML Modularization uses nmtokens, but it claims to be an XHTML 1.0 schema which uses CDATA, hence it should be CDATA.
Comment 5 Michael[tm] Smith 2009-04-30 04:17:06 CEST
(In reply to comment #3)
> The quantifier inside the comment should be +.

oops. I'll fix that.

> Other than that, look better
> than what's in currently, but is there any spec basis even for nmtokens of any
> number as opposed to any string?

As Geoffrey noted, the XHTML 1.0 schema uses CDATA

As far as the spec itself - http://www.w3.org/TR/html401/struct/global.html#adef-class  - that specifies the datatype for @class as "cdata-list". The spec never defines what a "cdata-list" is; that instance of "cdata-list" is just a hyperlink to the definition of CDATA in the spec. The text following says, "Multiple class names must be separated by white space characters."

The non-normative attribute quick reference that's an appendix to the spec - http://www.w3.org/TR/html4/index/attributes.html- gives the datatype as CDATA and has the comment "space-separated list of classes".

I notice that the HTML4 DTD and spec never actually use NMTOKENS anyway. I guess that's because in DTDs, there's no way to state that an attribute value can be zero or more NMTOKENS. So if they had used NMTOKENS, it would have meant that the attribute value could not be empty (because NMTOKENS is defined as 1 more more NMTOKEN). So I'd speculate that when the old HTML WG put together XHTML 1.1, they probably figured they were correcting that deficiency or something.  

Anyway, it does seems clearthat at this point that the XHTML1 schema should use the equivalent of CDATA. So I'll change the patch.
Comment 6 Michael[tm] Smith 2009-04-30 04:24:48 CEST
Created attachment 92 [details]
updated patch

patch changes datatype of class to RelaxNG "text" primitive
Comment 7 Michael[tm] Smith 2009-04-30 04:29:10 CEST
Created attachment 93 [details]
updated patch
Comment 8 Henri Sivonen 2009-05-01 03:10:05 CEST
Looks good.
Comment 9 Michael[tm] Smith 2009-05-01 04:36:49 CEST
validator r313 http://svn8.cvsdude.com/vvc/whattf/validator?view=revision&revision=313