-
-
Save ology/23cb192b6c464c338388b955fc56b0e1 to your computer and use it in GitHub Desktop.
mojo::dom::css
This file contains hidden or 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
| [ | |
| [ | |
| 'tag', 'p', { id => 'a' }, [ | |
| 'tag', 'div', {}, [ 'root', $_->[0][3] ], $_->[0], [ | |
| 'tag', 'p', { id => 'b' }, $_->[0][3], | |
| [ 'text', 123, $_->[0][3][5] ], | |
| ], | |
| ], [ 'text', 'Test', $_->[0] ], | |
| ], $_->[0][3][5], | |
| ] |
This file contains hidden or 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
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use Data::Dumper::Compact qw(ddc); | |
| use Mojo::DOM (); | |
| use Mojo::DOM::CSS (); | |
| my $dom = Mojo::DOM->new('<div><p id="a">Test</p><p id="b">123</p></div>'); | |
| my $css = Mojo::DOM::CSS->new(tree => $dom->tree); | |
| my $elements = $css->select('p'); | |
| print ddc $elements; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment