Skip to content

Commit

Permalink
a few examples for the match method
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 15, 2014
1 parent 4fc0e1d commit 9babb3f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Mojo/DOM.pm
Expand Up @@ -671,6 +671,14 @@ Match the CSS selector against this element and return it as a L<Mojo::DOM>
object or return C<undef> if it didn't match. All selectors from
L<Mojo::DOM::CSS/"SELECTORS"> are supported.
# True
!!$dom->parse('<p class="a">A</p>')->at('p')->match('.a');
!!$dom->parse('<p class="a">A</p>')->at('p')->match('p[class]');
# False
!!$dom->parse('<p class="a">A</p>')->at('p')->match('.b');
!!$dom->parse('<p class="a">A</p>')->at('p')->match('p[id]');
=head2 namespace
my $namespace = $dom->namespace;
Expand Down

0 comments on commit 9babb3f

Please sign in to comment.