Re: </FONT COLOR>

Gisle Aas (aas@bergen.sn.no)
13 Apr 1997 16:42:46 +0200


Michael R Cook <michael_cook@erawan> writes:

> Consider this HTML code:
> 
>   <FONT COLOR="#FF0000">Foo!</FONT COLOR><TITLE>Bar!</TITLE>
> 
> The malformed </FONT COLOR> markup seems to thoroughly confuse HTML::Parser.
> The result seems to be that all code thereafter is handled as straight text.
> 
> For example, this perl code:
> 
>  require HTML::TreeBuilder;
>  $h = new HTML::TreeBuilder;
>  $h->parse(q(<FONT COLOR="#FF0000">Foo!</FONT COLOR><TITLE>Bar!</TITLE>));
>  print $h->as_HTML;
> 
> generates this output:
> 
>  <HTML><BODY><P><FONT COLOR="#FF0000">Foo!FONT
>  COLOR&gt;&lt;TITLE&gt;Bar!&lt;/TITLE&gt;</FONT></BODY></HTML>
> 
> FWIW, Netscape navigator 3.01 seems to handle the malformed </FONT COLOR>
> markup correctly.
> 
> (I'm using libwww-perl-5.07).

I am not sure everybody will agree on what is correct.
libwww-perl-5.08 contains the following fix:

 o  HTML::Parser was confused about "</" when it did not start an end tag.

and produce the following output for your example:

  <HTML><BODY><P><FONT COLOR="#FF0000">Foo!&lt;/FONT COLOR&gt;<TITLE>Bar!</TITLE></FONT></BODY></HTML>


-- 
Gisle Aas <aas@sn.no>