W3C home > Mailing lists > Public > www-validator@w3.org > March 2013

Re: "textcenter" is not a member of a group specified for any attribute

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Thu, 28 Mar 2013 07:39:58 +0200
Message-ID: <5153D7AE.1070808@cs.tut.fi>
To: Izi Gifts <Info@izigifts.nl>
CC: www-validator@w3.org
2013-03-27 18:29, Izi Gifts wrote:

> Can you please take a look at the check below. I have named a div with
> “left” within quotation marks, but still I get this error. How is this
> possible?
> <p class=uspSecond textcenter *l*eft" title="We berekenen EUR 2,95
> verzendkoste…
> /Line 136, Column 33/:*"textcenter" is not a member of a group specified
> for any attribute*

I don’t see any div element there. I suppose you mean p, not div. 
Probably the real error is just the lack of a starting quotation mark 
("), i.e. the markup should be

<p class="uspSecond textcenter left" title="We berekenen EUR 2,95

Any attribute value that contains a space must be surrounded by 
quotation marks.

The error message looks odd, but you need not worry about it; just fix 
the error, and the message goes away. But for those interested, here’s 
what happens inside the validator:

What happens technically is that after parsing class=uspSecond and 
encountering a space, the validator (and a browser) treats the class 
attribute specification as ended. The next word is “textcenter”, and 
since it is not followed by an equals sign (=), the validator tries to 
recognize as an attribute value, for an attribute defined to take an 
enumerated value (such as “left”, “right”, and “center”, which are 
enumerated values of the “align” attribute). Since no attribute has such 
an enumerated value, the validator reports this, in its somewhat cryptic 
manner: “"textcenter" is not a member of a group specified for any 
attribute”. The word “left” does not cause an error message, because 
incidentally it happens to be a formally valid attribute specication: it 
means align="left".

What happens in browsers is somewhat different. They simply ignore the 
words “textcenter” and “left"” as unrecognized attribute names. Well, 
not quite. They have no effect as such, but they are included into the 
“attributes” array (well, really an array-like object), so that they act 
as element attributes in CSS styling and can be accessed in JavaScript.

By the way, if you validated against HTML5 rules, e.g. selecting “HTML5 
(experimental)” from the “Doctype” dropdown, you would get a more 
understandable error message in this case:

“Quote " in attribute name. Probable cause: Matching quote missing 
somewhere earlier.”

(HTML5 rules differ in many ways from HTML 4.01 rules, so you might get 
confused with *other* error messages, though.)

Received on Thursday, 28 March 2013 05:40:27 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:18:08 UTC