Skip to content

Commit

Permalink
added a few more Mojo::DOM examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 6, 2014
1 parent e6eca12 commit 481c66c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Mojo/DOM.pm
Expand Up @@ -518,6 +518,9 @@ Append new content to this node's content.
# "<!-- A B --><br>"
$dom->parse('<!-- A --><br>')->contents->first->append_content('B ')->root;
# "<p>A<i>B</i></p>"
$dom->parse('<p>A</p>')->at('p')->append_content('<i>B</i>')->root;
=head2 at
my $result = $dom->at('html title');
Expand Down Expand Up @@ -575,6 +578,9 @@ Return this node's content or replace it with new content.
# "<!-- B --><br>"
$dom->parse('<!-- A --><br>')->contents->first->content(' B ')->root;
# "<p><i>B</i></p>"
$dom->parse('<p>A</p>')->at('p')->content('<i>B</i>')->root;
=head2 contents
my $collection = $dom->contents;
Expand Down Expand Up @@ -699,6 +705,9 @@ Prepend new content to this node's content.
# "<!-- A B --><br>"
$dom->parse('<!-- B --><br>')->contents->first->prepend_content(' A')->root;
# "<p><i>B</i>A</p>"
$dom->parse('<p>A</p>')->at('p')->prepend_content('<i>B</i>')->root;
=head2 previous
my $sibling = $dom->previous;
Expand Down

0 comments on commit 481c66c

Please sign in to comment.