Recovering from extra framesets

IE and Netscape seem to ignore extra framesets while 26-Jul-99 Tidy treats
them as errors.

I hope it's not rash to assume that in cases like this, we want Tidy to
approximate what most users are likely to experience in their browsers.

-------- Example input document --------
<html>
<head>
<title>t</title>
</head>

<frameset cols="50%,50%">
  <frame src="a.html">
  <frame src="b.html">
</frameset>

<frameset>
  <frame src="ignored-by-browsers.html">
</frameset>

</html>
----------------------------------------

The following changes should cause Tidy to discard extra framesets.  Note
the potential problem described in the comments.  The changes are untested
in C but they were translated from Java where they WERE tested.

1. In parser.c, change:

      /* flag an error if we see more than one frameset */

   to:

      /* parse framesets but only keep the first one */
      /* PROBLEM: Discarded framesets might still affect the */
      /*          global document state when they are parsed */

2. Also in parser.c, change:

      if (frameset != null)
          ReportError(lexer, html, node, DUPLICATE_FRAMESET);
      else
          frameset = node;

   to:

      if (frameset != null)
      {
          ReportWarning(lexer, html, node, DUPLICATE_FRAMESET);
          ParseTag(lexer, node, mode);
          continue;
      }
      frameset = node;

3. In localize.c, change DUPLICATE_FRAMESET from an error to a warning (be
sure to change the string literal itself, too).

Randy

Received on Thursday, 16 September 1999 14:56:22 UTC