On Fri, Feb 06, 2009 at 01:34:24PM -0300, Jorge Arellano Cid wrote:
On Fri, Feb 06, 2009 at 04:01:58PM +0100, Hofmann Johannes wrote:
On Fri, Feb 06, 2009 at 11:59:01AM -0300, Jorge Arellano Cid wrote:
On Fri, Feb 06, 2009 at 12:38:20PM +0100, Hofmann Johannes wrote:
On Fri, Feb 06, 2009 at 11:06:11AM +0100, Hofmann Johannes wrote:
On Fri, Feb 06, 2009 at 10:58:37AM +0100, Hofmann Johannes wrote:
On Fri, Feb 06, 2009 at 06:22:54AM +0000, corvid wrote: > <a name="a"></a> > <p id="p"></p> > <p> > <a name="same" id="same"></a> > > gives > HTML warning: line 2, 'id' and 'name' attribute of <a> tag differ > HTML warning: line 4, Anchor names must be unique within the document > > Dillo would seem to be unhappy now that the id attr is checked before > open_a checks the name attr -- but then it looks like the move was > made in October (a88b4a31cb7a) and I have a dillo around from > roughly Dec. 22 that does not have a problem with this.
Yes, the problem was caused by moving the check.
> > In any case, I don't know whether there are styleEngine issues with > just sticking the id check back after the open.
We need to parse the "id" attribute before the open, as it's used to determine the style used in open*.
But I don't understand the reason for the name/id check in the first place:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>foo bar</title> </head> <body> <a name="foo" id="bar">foo bar</a> </body> </html>
is correct HTML according to http://validator.w3.org/. I would propose to remove this check completely. Opinions?
Ooops, stop! I just found this: http://www.validome.org/lang/ge/errors/MISC/3005 It seems that name and id must be equal and it's a bug in http://validator.w3.org/ that it doesn't catch it. I will try to fix the check in dillo.
Please test/review current tip
After a quick review, it seems to me that the proper solution is to add a test in the open function for A, APPLET, FORM, FRAME, IFRAME, IMG and MAP. Something like:
if (id && nameVal && strcmp(nameVal, id)) BUG_MSG("'id' and 'name' attribute of <%s> tag differ\n", tag_name); if (nameVal) Html_add_anchor(html, nameVal);
If id and nameVal don't differ, we don't want to call Html_add_anchor(). It has already been called with the same value from Html_parse_common_attrs().
We could put the corresponding code that is currently in Html_tag_open_a() in a new function Html_handle_name_attr() and call that from all elements that allow a "name" attribute.
Right, that's the idea. Maybe:
if (id && strcmp(nameVal, id) == 0) { BUG_MSG("'id' and 'name' attribute of <a> tag differ\n"); } else { Html_add_anchor(html, nameVal); }
That's not quite it. I think the original test, that I now moved to Html_tag_open_a() is ok: if (!id || strcmp(nameVal, id)) { if (id) BUG_MSG("'id' and 'name' attribute of <a> tag differ\n"); Html_add_anchor(html, nameVal); } I.e. do something if id is not set or id and name differ. Then if they differ output a warning. Add an anchor for the new string. Cheers, Johannes