Re: HTML is a declarative mark-up language

On Jan 28, 2009, at 5:47 PM, Roy T. Fielding wrote:

> If I ask a simple question, like:
>
>   what does the name attribute on the "a" (anchor) element mean?

The name attribute on the "a" element is no longer conforming for  
documents. It is considered obsolete in favor of using "id". The id  
attribute is defined here: "http://www.w3.org/TR/html5/semantics.html#the-id 
". The "a" element itself is also defined (it now represents a  
hyperlink rather than an anchor).


> how do I find the answer in HTML5? Well, supposedly I look at the ToC
> for the a element, find it eventually under "Text-level Semantics" at
> <http://www.w3.org/TR/html5/text-level.html#the-a>, and discover that
> there is apparently no "name" attribute for <a> and, further, that <a>
> doesn't even mean anchor any more.  Brilliant.
>
> Oh, but maybe it's defined in the operational behavior ...
>
> "The activation behavior of <a> elements that represent hyperlinks
> is to run the following steps:"  Nope, that's DOM.
>
> You'd almost think that name was removed, but then if we happen to be
> reading the section on Web Browsers we find...
>
> <http://www.w3.org/TR/html5/history.html#scroll-to-fragid>
>
> "4. If there is an <a> element in the DOM that has a name attribute
> whose value is exactly equal to fragid, then the first such element
> in tree order is the indicated part of the document; stop the  
> algorithm here.
>
> The name attribute is used but never defined, AFAICT.  I just happened
> to run across this error in the first element that I looked at in
> the HTML5 spec today, and it is hidden because the declarative  
> language
> is being obscured by the behavioral descriptions.

"name" has implementation conformance requirements for compatibility,  
but may not be used by conforming documents and so the semantics and  
authoring requirements are not defined. I believe this is both  
correct, and also not a representative example of how semantics are  
defined.

I think it would be helpful for the spec to have a list of elements  
and attributes that have a functional effect but are not conforming  
for documents, to avoid confusion like this.

As a side note, here is how HTML 4.01 defines the A element's name  
attribute:

"This attribute names the current anchor so that it may be the  
destination of another link. The value of this attribute must be a  
unique anchor name. The scope of this name is the current document.  
Note that this attribute shares the same name space as the id  
attribute."

Note that this is a completely operational definition which does not  
clearly state the meaning of the attribute.

Regards,
Maciej

Received on Thursday, 29 January 2009 02:11:58 UTC