-
-
Save anonymous/43868b7f2326c2496775 to your computer and use it in GitHub Desktop.
ugly hack to find to enable to return of Mojo::DOM objects rather than a colleciton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub find { | |
my ($self, $selector, $dom) = @_; | |
# Match selector against tree | |
my $results = Mojo::DOM::CSS->new(tree => $self->tree)->select($selector); | |
# Upgrade results | |
@$results | |
= map { $self->new->charset($self->charset)->tree($_)->xml($self->xml) } | |
@$results; | |
return @$results if ($dom); | |
return Mojo::Collection->new(@$results); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment