Simple Machines Community Forum

Customizing SMF => Graphics and Templates => Aiheen aloitti: Zargony - syyskuu 21, 2005, 08:17:30 AP

Otsikko: Default theme: Use of name attribute in <a> elements is deprecated
Kirjoitti: Zargony - syyskuu 21, 2005, 08:17:30 AP
In SMF 1.1b3, the default theme uses the DTD XHTML 1.0 Transitional. However, it outputs <a> elements with only a name attribute, which is deprecated by the XHTML 1.0 standard because it's replaced by the id attribute.

In XHTML, the "name" attribute has been deprecated and replaced by the "id" attribute. If you want to keep both tags for compatibility reason, name and id, the values should be the same.
This error is generated when only the name exists and that tidy try to copy the value of the name in the id attribute. But an "id" must begin with a letter ([A-Za-z]).
Solution:

BAD         <a name="123456">...</a>
BAD         <a id="123456">...</a>

DEPRECATED  <a name="my_link">...</a>

GOOD        <a id="my_link">...</a>
GOOD        <a id="my_link" name="my_link">...</a>

References:

XHTML W3c spec: name attribute: http://www.w3.org/TR/xhtml1/#h-4.10
XHTML W3c spec: name and id  http://www.w3.org/TR/xhtml1/#C_8
ID W3C spec: http://www.w3.org/TR/html4/types.html#h-6.2
Otsikko: Re: Default theme: Use of name attribute in <a> elements is deprecated
Kirjoitti: phil_roy - huhtikuu 13, 2006, 08:54:34 IP
I can't seem to find the fix for this as I have the same issue in a couple of other templates?

Phil
Otsikko: Re: Default theme: Use of name attribute in <a> elements is deprecated
Kirjoitti: bloc - huhtikuu 15, 2006, 04:12:53 AP
You should be able to use both id and name in a link, and set their values alike. The error really describes it there.
Otsikko: Re: Default theme: Use of name attribute in <a> elements is deprecated
Kirjoitti: phil_roy - huhtikuu 15, 2006, 04:39:35 AP
I have no idea what you mean sorry. I can see that name="1" and id="1" are both not acceptable according to the orginal post I have a theme that is generating a link that begins...

<a name="1" href=

This is the link on that forum for collapsing a board. When I asked if there was a fix, it is becuase I don;t knwo where to find the issue or what to change to resolve it.

Cheers,

Phil
Otsikko: Re: Default theme: Use of name attribute in <a> elements is deprecated
Kirjoitti: bloc - huhtikuu 15, 2006, 04:49:54 AP
Sorry, i see now what you mean now. Actually the default theme should not have links with the name attribute starting with a number. Which it does now.
Otsikko: Re: Default theme: Use of name attribute in <a> elements is deprecated
Kirjoitti: phil_roy - huhtikuu 15, 2006, 04:51:15 AP
And the fix?  ;D

Phil
Otsikko: Re: Default theme: Use of name attribute in <a> elements is deprecated
Kirjoitti: bloc - huhtikuu 15, 2006, 04:57:15 AP
It needs to be changed in the Souces files - BoardIndex.php. But several things need changing, as the index.php?#5 will go to category 5 - which the name is set to.