1 use Test::More tests => 3;
6 my $p = HTML::Parser->new(api_version => 3);
12 $p->handler(start => \&a_handler, "skipped_text, text");
13 $p->handler(end_document => \@doc, '@{skipped_text}');
15 $p->parse(<<EOT)->eof;
17 <h1><a href="foo">link</a></h1>
18 and <a foo="">some</a> text.
24 push(@doc, uc($text));
28 is(join("", @doc), <<'EOT');
30 <h1><A HREF="FOO">link</a></h1>
31 and <A FOO="">some</a> text.
35 # Comment stripper. Interaction with "" handlers.
40 and some more <b>text</b>.
42 (my $expected = $doc) =~ s/<!--.*?-->//;
44 $p = HTML::Parser->new(api_version => 3);
45 $p->handler(comment => "");
46 $p->handler(end_document => sub {
49 is($stripped, $expected);
51 for (split(//, $doc)) {
57 # Interaction with unbroken text
60 $p = HTML::Parser->new(api_version => 3, unbroken_text => 1);
61 $p->handler(text => \@x, '@{"X", skipped_text, text}');
62 $p->handler(end => "");
63 $p->handler(end_document => \@x, '@{"Y", skipped_text}');
65 $doc = "a a<a>b b</a>c c<x>d d</x>e";
67 for (split(//, $doc)) {
73 is(join(":", @x), "X::a a:X:<a>:b bc c:X:<x>:d de:Y:");