Skip to content

Commit

Permalink
a few small formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 14, 2014
1 parent 9d06a53 commit b46894b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,5 +1,6 @@

5.50 2014-10-11
5.50 2014-10-14
- Fixed description list parsing bug in Mojo::DOM::HTML. (Trelane)

5.49 2014-10-10
- Improved form content generator to allow custom content types.
Expand Down
6 changes: 1 addition & 5 deletions lib/Mojo/DOM/HTML.pm
Expand Up @@ -54,11 +54,7 @@ my %RAW = map { $_ => 1 } qw(script style);
my %RCDATA = map { $_ => 1 } qw(title textarea);

# HTML elements with optional end tags
my %END = (
body => ['head'],
rp => [qw(rt rp)],
rt => [qw(rt rp)]
);
my %END = (body => ['head'], rp => [qw(rt rp)], rt => [qw(rt rp)]);
$END{$_} = [$_] for qw(optgroup option);

# HTML elements that break paragraphs
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojolicious.pm
Expand Up @@ -895,6 +895,8 @@ Magnus Holm
Maik Fischer
Mark Fowler
Mark Grimes
Mark Stosberg
Expand Down
32 changes: 16 additions & 16 deletions t/mojo/dom.t
Expand Up @@ -1311,22 +1311,6 @@ is $dom->find('dl > dd')->[1]->text, 'D', 'right text';
is $dom->find('dl > dt')->[2]->text, 'E', 'right text';
is $dom->find('dl > dd')->[2]->text, 'F', 'right text';

# but different levels don't self-terminate to allow for nesting
$dom = Mojo::DOM->new->parse(<<EOF);
<dl>
<dt>A</dt>
<DD>
<dl>
<dt>B</dt>
<dd>C</dd>
</dl>
</dd>
</dl>
EOF
is $dom->find('dl > dd > dl > dt')->[0]->text, 'B', 'right text';
is $dom->find('dl > dd > dl > dd')->[0]->text, 'C', 'right text';
is $dom->find('dl > dt')->[0]->text, 'A', 'right text';

# Optional "rp" and "rt" tags
$dom = Mojo::DOM->new->parse(<<EOF);
<ruby>
Expand Down Expand Up @@ -2297,6 +2281,22 @@ is "$dom", <<EOF, 'right result';
<bar>after</bar>
EOF

# Nested description lists
$dom = Mojo::DOM->new->parse(<<EOF);
<dl>
<dt>A</dt>
<DD>
<dl>
<dt>B
<dd>C
</dl>
</dd>
</dl>
EOF
is $dom->find('dl > dd > dl > dt')->[0]->text, 'B', 'right text';
is $dom->find('dl > dd > dl > dd')->[0]->text, 'C', 'right text';
is $dom->find('dl > dt')->[0]->text, 'A', 'right text';

# Nested lists
$dom = Mojo::DOM->new(<<EOF);
<div>
Expand Down

0 comments on commit b46894b

Please sign in to comment.