Skip to content

Commit

Permalink
made wrap examples a little easier to follow
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 4, 2014
1 parent 04b4da0 commit 62de666
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,4 +1,6 @@

4.77 2014-02-05

4.76 2014-02-04
- Added wrap method to Mojo::DOM.
- Updated IO::Socket::IP requirement to 0.20 for certain bug fixes.
Expand Down
14 changes: 7 additions & 7 deletions lib/Mojo/DOM.pm
Expand Up @@ -812,19 +812,19 @@ This element's type.
=head2 wrap
$dom = $dom->wrap('<p></p>');
$dom = $dom->wrap('<div></div>');
Wrap HTML/XML fragment around this element, placing it as the last child of
the first innermost element.
# "<div>B<h1>A</h1></div>"
$dom->parse('<h1>A</h1>')->at('h1')->wrap('<div>B</div>')->root;
# "<p>B<b>A</b></p>"
$dom->parse('<b>A</b>')->at('b')->wrap('<p>B</p>')->root;
# "<div><div><h1>A</h1></div>B</div>"
$dom->parse('<h1>A</h1>')->at('h1')->wrap('<div><div></div>B</div>')->root;
# "<div><p><b>A</b></p>B</div>"
$dom->parse('<b>A</b>')->at('b')->wrap('<div><p></p>B</div>')->root;
# "<div><h1>A</h1></div><div>B</div>"
$dom->parse('<h1>A</h1>')->at('h1')->wrap('<div></div><div>B</div>')->root;
# "<p><b>A</b></p><p>B</p>"
$dom->parse('<b>A</b>')->at('b')->wrap('<p></p><p>B</p>')->root;
=head2 xml
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -43,7 +43,7 @@ has types => sub { Mojolicious::Types->new };
has validator => sub { Mojolicious::Validator->new };

our $CODENAME = 'Top Hat';
our $VERSION = '4.76';
our $VERSION = '4.77';

sub AUTOLOAD {
my $self = shift;
Expand Down

0 comments on commit 62de666

Please sign in to comment.