Skip to content

Commit

Permalink
more tests for smart whitespace trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 19, 2013
1 parent 1f82baa commit 173b21c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/DOM.pm
Expand Up @@ -329,7 +329,7 @@ sub _sibling {
sub _text {
my ($nodes, $recurse, $trim) = @_;

# Merge successing text nodes
# Merge successive text nodes
my $i = 0;
while (my $next = $nodes->[$i + 1]) {
++$i and next unless $nodes->[$i][0] eq 'text' && $next->[0] eq 'text';
Expand Down
7 changes: 4 additions & 3 deletions t/mojo/dom.t
Expand Up @@ -1109,13 +1109,14 @@ is "$dom", <<EOF, 'right result';
</ul>
<div>D</div>works
EOF
$dom->find('li')->[1]->append_content('<p>C2</p>C3')->append_content(' C4');
is $dom->find('li')->[1]->text, 'C C3 C4', 'right text';
$dom->find('li')->[1]->append_content('<p>C2</p>C3')->append_content(' C4')
->append_content('C5');
is $dom->find('li')->[1]->text, 'C C3 C4C5', 'right text';
is "$dom", <<EOF, 'right result';
<ul>
24<div>A-1</div>works25<li>A4A3<p>A2</p>A</li><p>A1</p>23
<p>B</p>
<li>C<p>C2</p>C3 C4</li>
<li>C<p>C2</p>C3 C4C5</li>
</ul>
<div>D</div>works
EOF
Expand Down

0 comments on commit 173b21c

Please sign in to comment.