Re: behavior of HTML::Formatter when more "end" than "start" tags seen
Gisle Aas (aas@bergen.sn.no)
Mon, 07 Oct 1996 10:42:10 +0200
In message <199610070414.VAA18492@kelly.teleport.com>, Aaron Nabil writes:
> In HTML::Formatter there is code to keep track of tags seen like
> this...
>
> sub begin
> {
> my $self = shift;
> . . .
> $self->{bold} = 0;
> . . .
> }
>
> sub b_start
> {
> shift->{bold}++;
> 1;
> }
>
> sub b_end
> {
> shift->{bold}--;
> }
>
> The problem being that if more "end" tags than "start" are seen it has the
> undesirable behavior of decrementing bold below zero.
This will never happen! (at least I hope so :-)
The calls to b_start() and b_end() are made as we traverse the
HTML::Element syntax tree. The syntax tree only has one node for <b>
and we call b_start() when we enter the node and b_end() when we leave
it.
> The only thing I did confirm is that the netscape browser doesn't
> have memory of "end" tags that exceede the count of "start" tags seen.
The HTML::TreeBuilder will ignore unmatched </b> tags when it builds
the syntax tree.
Regards,
Gisle.