Skip to content

Commit

Permalink
fixed a few Mojo::DOM examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 2, 2012
1 parent b6879ff commit 8fdbbfa
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/Mojo/DOM.pm
Expand Up @@ -513,7 +513,7 @@ enabled by default.
Append to element.
# "<div><h1>A</h1><h2>B</h2></div>"
$dom->parse('<div><h1>A</h1></div>')->at('h1')->append('<h2>B</h2>');
$dom->parse('<div><h1>A</h1></div>')->at('h1')->append('<h2>B</h2>')->root;
=head2 C<append_content>
Expand All @@ -522,7 +522,7 @@ Append to element.
Append to element content.
# "<div><h1>AB</h1></div>"
$dom->parse('<div><h1>A</h1></div>')->at('h1')->append_content('B');
$dom->parse('<div><h1>A</h1></div>')->at('h1')->append_content('B')->root;
=head2 C<at>
Expand Down Expand Up @@ -617,7 +617,7 @@ Alias for L<Mojo::DOM::HTML/"parse">.
Prepend to element.
# "<div><h1>A</h1><h2>B</h2></div>"
$dom->parse('<div><h2>B</h2></div>')->at('h2')->prepend('<h1>A</h1>');
$dom->parse('<div><h2>B</h2></div>')->at('h2')->prepend('<h1>A</h1>')->root;
=head2 C<prepend_content>
Expand All @@ -626,19 +626,19 @@ Prepend to element.
Prepend to element content.
# "<div><h2>AB</h2></div>"
$dom->parse('<div><h2>B</h2></div>')->at('h2')->prepend_content('A');
$dom->parse('<div><h2>B</h2></div>')->at('h2')->prepend_content('A')->root;
=head2 C<replace>
my $old = $dom->replace('<div>test</div>');
Replace elements.
Replace element.
# "<div><h2>B</h2></div>"
$dom->parse('<div><h1>A</h1></div>')->at('h1')->replace('<h2>B</h2>');
$dom->parse('<div><h1>A</h1></div>')->at('h1')->replace('<h2>B</h2>')->root;
# "<div></div>"
$dom->parse('<div><h1>A</h1></div>')->at('h1')->replace('');
$dom->parse('<div><h1>A</h1></div>')->at('h1')->replace('')->root;
=head2 C<replace_content>
Expand All @@ -647,10 +647,10 @@ Replace elements.
Replace element content.
# "<div><h1>B</h1></div>"
$dom->parse('<div><h1>A</h1></div>')->at('h1')->replace_content('B');
$dom->parse('<div><h1>A</h1></div>')->at('h1')->replace_content('B')->root;
# "<div><h1></h1></div>"
$dom->parse('<div><h1>A</h1></div>')->at('h1')->replace_content('');
$dom->parse('<div><h1>A</h1></div>')->at('h1')->replace_content('')->root;
=head2 C<root>
Expand Down Expand Up @@ -706,8 +706,8 @@ is enabled by default.
Render this element and its content to XML.
# "<div><b>test</b></div>"
$dom->parse('<div><b>test</b></div>')->div->to_xml;
# "<b>test</b>"
$dom->parse('<div><b>test</b></div>')->div->b->to_xml;
=head2 C<tree>
Expand Down

0 comments on commit 8fdbbfa

Please sign in to comment.