Re: Amaya 9.99-4 WinXP bug: [ and ] characters in name attribute of form elements

Hi Benjamin  and Bartolomé,

Even if it's not trivial to do, Amaya now checks the document type and the 
element type before applying the id value constraint.

On Saturday 02 February 2008 12:30, Benjamin Hawkes-Lewis wrote:
> Bartolomé Sintes Marco wrote:
> > Hi Irène,
> >
> > Irene Vatton escribió:
> >  > Within XHTML documents, the name attribute value must be duplicated
> >
> > into the
> >
> >  > id attribute. So the following restriction is applied:
> >
> > The W3C validator does not follow this rule (name attribute must be
> > duplicated into id attribute). The following source code is checked as
> > valid XHTML 1.0 Strict:
>
> [snip]
>
> > <p>Text: <input type="text" name="text[1]" /></p>
>
> [snip]
>
> > So, is it a bug of the W3C Validator?
>
> Nope. Irene has confused the NAME data type and the name attribute,
> which has different data types and meanings depending on what element
> you put it on, and has ended up quoting the wrong spec.
>
> In HTML 4.01, the data type of the name attribute is usually CDATA,
> which allows square brackets:
>
> http://www.w3.org/TR/html401/index/attributes.html
>
> The one exception is on the "meta" element, where it has type NAME.
>
> Where @name is used as a fallback for @id, the value of @name MUST be
> identical to any @id value, in which case it would be constrained to
> type ID:
>
> http://www.w3.org/TR/html4/struct/links.html#anchors-with-id
>
> However, on "meta" and "input" elements, @name is /never/ a fallback for
> @id and it makes no sense to enforce such restrictions in the authoring
> tool, especially as PHP depends on square brackets in @name on form
> controls in order to construct arrays from submitted key value pairs.
>
> Now XHTML 1.0 introduced several changes to @id, @name, and best
> practice. See especially:
>
> http://www.w3.org/TR/xhtml1/#h-4.10
>
> http://www.w3.org/TR/xhtml1/#C_8
>
> Note that, on the "meta" element, @name went from NAME to CDATA, so it
> now allows square brackets:
>
> http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-strict.dtd_meta
>
> In the case of "input", @name /still/ isn't a fragment identifier and it
> still remained defined as CDATA, so square brackets are still allowed:
>
> http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-strict.dtd_input
>
> Therefore, input name="text[1]" is conforming HTML 4.01 and valid XHTML
> 1.0 and it is destructive for the authoring tool to correct it.
>
> Hope that helps.
>
> --
> Benjamin Hawkes-Lewis

-- 
Irène Vatton @ INRIA Rhône-Alpes

Received on Tuesday, 5 February 2008 08:14:26 UTC