Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed parent combinator bug in Mojo::DOM::CSS
  • Loading branch information
kraih committed Dec 4, 2014
1 parent 23a95db commit 7572622
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,5 +1,6 @@

5.69 2014-12-03
5.69 2014-12-05
- Fixed parent combinator bug in Mojo::DOM::CSS.

5.68 2014-12-02
- Improved Mojo::DOM::CSS performance significantly.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/DOM/CSS.pm
Expand Up @@ -150,7 +150,7 @@ sub _match {
sub _parent {
my ($selectors, $current, $tree, $pos) = @_;
return undef unless my $parent = $current->[3];
return undef if $parent->[0] eq 'root';
return undef if $parent->[0] eq 'root' || $parent eq $tree;
return _combinator($selectors, $parent, $tree, $pos);
}

Expand Down
3 changes: 3 additions & 0 deletions t/mojo/dom.t
Expand Up @@ -1974,6 +1974,9 @@ $dom->find('b')->each(
}
);
is_deeply \@results, [qw(baz yada)], 'right results';
is $dom->at('b')->at('a')->text, 'bar', 'right text';
is $dom->at('c > b > a')->text, 'bar', 'right text';
is $dom->at('b')->at('c > b > a'), undef, 'no result';

# Direct hash access to attributes in XML mode
$dom = Mojo::DOM->new->xml(1)->parse(<<EOF);
Expand Down

0 comments on commit 7572622

Please sign in to comment.