diff -Nru libhtml-tree-perl-5.02/Changes libhtml-tree-perl-5.03/Changes --- libhtml-tree-perl-5.02/Changes 2012-06-27 21:18:34.000000000 +0000 +++ libhtml-tree-perl-5.03/Changes 2012-09-23 01:11:20.000000000 +0000 @@ -1,5 +1,19 @@ Changelog for HTML-Tree +5.03 2012-09-22 + Release by Christopher J. Madsen + + [THINGS THAT MAY BREAK YOUR CODE OR TESTS] + * as_HTML no longer indents " + ); + my $unindented = $html->as_HTML; + my $indented = $html->as_HTML(undef, " "); + + has_no_content($unindented, qw(unindented pre)); + has_no_content($unindented, qw(unindented textarea)); + has_no_content($indented, qw(indented pre)); + has_no_content($indented, qw(indented textarea)); +} diff -Nru libhtml-tree-perl-5.02/t/building.t libhtml-tree-perl-5.03/t/building.t --- libhtml-tree-perl-5.02/t/building.t 2012-06-27 21:18:34.000000000 +0000 +++ libhtml-tree-perl-5.03/t/building.t 2012-09-23 01:11:20.000000000 +0000 @@ -5,7 +5,7 @@ #Test that we can build and compare trees -use Test::More tests => 42; +use Test::More tests => 46; use HTML::Element; @@ -17,7 +17,7 @@ 'stuff', [ 'p', 'um, p < 4!', { 'class' => 'par123' } ], [ 'div', { foo => 'bar' }, ' 1 2 3 ' ], # at 0.1.2 - [ 'div', { fu => 'baa' }, " 1   2 \xA0 3 " ], # RT #26436 test + [ 'div', { fu => 'baa' }, " 1 and 2 \xA0 3 " ], # RT #26436 test ['hr'], ] ]; @@ -70,11 +70,13 @@ isa_ok( $div2, 'HTML::Element' ); ### test for RT #26436 user controlled white space - is( $div2->as_text(), " 1   2 \xA0 3 ", "Dump element in text format" ); + is( $div2->as_text(), " 1 and 2 \xA0 3 ", "Dump element in text format" ); is( $div2->as_trimmed_text(), - "1   2 \xA0 3", "Dump element in trimmed text format" ); - is( $div2->as_trimmed_text( extra_chars => ' \xA0' ), - "1 2 3", "Dump element in trimmed text format" ); + "1 and 2 \xA0 3", "Dump element in trimmed text format" ); + is( $div2->as_trimmed_text( extra_chars => 'a-z\xA0' ), + "1 2 3", "Dump element in trimmed text format without nbsp or letters"); + is( $div2->as_trimmed_text( extra_chars => '[:alpha:]' ), + "1 2 \xA0 3", "Dump element in trimmed text format without letters"); my $t2 = HTML::Element->new_from_lol($lol); isa_ok( $t2, 'HTML::Element' ); @@ -140,3 +142,11 @@ ok( not grep( 'bar', $t1->all_external_attr() ) ); $t1->delete; } # TEST2 + +EXTRA_CHARS_IS_FALSE: { + my $h = HTML::Element->new_from_lol([p => '1 2 0 4']); + is( $h->as_text, '1 2 0 4', "Dump p in text format" ); + is( $h->as_trimmed_text, '1 2 0 4', "Dump p in trimmed format" ); + is( $h->as_trimmed_text(extra_chars => '0'), '1 2 4', + "Dump p in trimmed format without 0" ); +} diff -Nru libhtml-tree-perl-5.02/t/whitespace.t libhtml-tree-perl-5.03/t/whitespace.t --- libhtml-tree-perl-5.02/t/whitespace.t 2012-06-27 21:18:34.000000000 +0000 +++ libhtml-tree-perl-5.03/t/whitespace.t 2012-09-23 01:11:20.000000000 +0000 @@ -17,7 +17,7 @@ "

This\xA0has nbsp: \xA0

", ); -plan tests => scalar @tests; +plan tests => 1 + scalar @tests; for my $test (@tests) { my $tree = HTML::TreeBuilder->new; @@ -32,3 +32,11 @@ is($tree->look_down(qw(_tag body))->as_HTML('<>&', undef, {}), "$test", $name); } # end for each $test in @tests + +RT_66498: { + is( HTML::TreeBuilder->new_from_content("

a

b

") + ->as_text, + "ab", + "parsing does not add whitespace" + ); +}