Skip to content

Commit

Permalink
fixed empty attribute bug in Mojo::DOM::CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jul 29, 2013
1 parent db1c60a commit 310a98a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@

4.22 2013-07-30
- Improved Mojo::Server to use FindBin more defensively.
- Fixed empty attribute bug in Mojo::DOM::CSS.
- Fixed partial route handling in routes command.

4.21 2013-07-29
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/DOM/CSS.pm
Expand Up @@ -10,7 +10,7 @@ my $ATTR_RE = qr/
(?:
(\W)? # Operator
=
(?:"((?:\\"|[^"])+)"|(\S+)) # Value
(?:"((?:\\"|[^"])*)"|(\S+)) # Value
)?
\]
/x;
Expand Down
6 changes: 6 additions & 0 deletions t/mojo/dom.t
Expand Up @@ -584,6 +584,12 @@ is $dom->at('[id="><"]')->attr->{id}, '><', 'right attribute';
$dom = Mojo::DOM->new->parse(qq{<div test="" test2='' />});
is $dom->at('div')->attr->{test}, '', 'empty attribute value';
is $dom->at('div')->attr->{test2}, '', 'empty attribute value';
is $dom->at('[test]')->type, 'div', 'right type';
is $dom->at('[test2]')->type, 'div', 'right type';
is $dom->at('[test3]'), undef, 'no result';
is $dom->at('[test=""]')->type, 'div', 'right type';
is $dom->at('[test2=""]')->type, 'div', 'right type';
is $dom->at('[test3=""]'), undef, 'no result';

# Whitespaces before closing bracket
$dom = Mojo::DOM->new->parse(qq{<div >content</div>});
Expand Down

0 comments on commit 310a98a

Please sign in to comment.