Closed Bug 18661 Opened 25 years ago Closed 25 years ago

Missing </a> tags not handled gracefully if next <a> is inside <table>

Categories

(Core :: Layout, defect, P3)

x86
All
defect

Tracking

()

VERIFIED DUPLICATE of bug 7724

People

(Reporter: pontus, Assigned: harishd)

References

()

Details

I have verified this problem with:
Linux 2.2: Mozilla M8, M9, M10
Windows NT 4.0: Mozilla M10

Missing </a> tags are not always handled gracefully, making some web pages with
erroneous HTML unusable in Mozilla even if they work in other browsers (e.g.
Netscape).

The following HTML fragment demonstrates the problem:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <title>test</title>
  </head>
  <body>
    <h1>test</h1>
    <a href="url1">text1
      <table>
	<tr><td><a href="url2">text2</a></tr></td>
	</table>
  </body>
</html>

the first link is obviously missing a </a> tag somewhere. In other browsers,
the second <a> tag closes the first <a>, making the page work correctly
for the user.

With the Mozilla versions I have tested, both text1 and text2 will become links
to url1.

NOTE: the problem seems to be caused by the second link being inside a <table>.
A fragment like this will NOT cause the problem:
<a href="url1">text1
<a href="url2">text2</a>

An example of a page with this problem is http://www.infoworld.com, which has
had this problem for a long time now (since Mozilla M8 at least). It is of
course "their fault", but I think handling erroneous HTML as gracefully as
possible would be very nice of Mozilla (it would enable me to read my favourite
pages in my favourite browser).
Assignee: rickg → harishd
One for you -- perfect timing too!
This topic has previously gotten attention in bug 17518 "[4.xP] Problem with
non-href anchors", currently marked fixed. In that bug report the emphasis
was on unclosed <A NAME="whatever"> - often ="Top" at the top of the page.
Some of that discussion may be relevant here.

It looks like this is a general problem for all <A> elements: they must not
nest, and when they appear to, bad things happen. In the testcase here,
with the unbalanced <A> enclosing the <table> enclosing the balanced <A>,
I don't think the parser has any choice but to treat them as nested - which,
of course, should never happen.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → DUPLICATE
Similar to 7724.  'A' did not get closed on encountering TABLE.  This caused the
second 'A' to get closed ( since A nesting is not allowed ) and therefore
resulting with the same URL for both achors!!

*** This bug has been marked as a duplicate of 7724 ***
Status: RESOLVED → VERIFIED
Agreed. Marking as a verified dup of 7724.
SPAM. HTML Element component deprecated, changing component to Layout. See bug
88132 for details.
Component: HTML Element → Layout
You need to log in before you can comment on or make changes to this bug.