Skip to content

Commit

Permalink
mention that some Mojo::DOM methods can return undef
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 19, 2013
1 parent 3318bcb commit 6da36db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

3.96 2013-04-19
3.96 2013-04-20
- Updated jQuery to version 2.0.
- Updated prettify.js to version 4-Mar-2013.
- Improved default descriptions in Test::Mojo.
Expand Down
18 changes: 11 additions & 7 deletions lib/Mojo/DOM.pm
Expand Up @@ -489,8 +489,9 @@ Append to element content.
my $result = $dom->at('html title');
Find a single element with CSS selectors and return it as a L<Mojo::DOM>
object. All selectors from L<Mojo::DOM::CSS> are supported.
Find first element matching the CSS selector and return it as a L<Mojo::DOM>
object or return C<undef> if none could be found. All selectors from
L<Mojo::DOM::CSS> are supported.
# Find first element with "svg" namespace definition
my $namespace = $dom->at('[xmlns\:svg]')->{'xmlns:svg'};
Expand Down Expand Up @@ -536,8 +537,8 @@ C<charset> has been defined.
my $collection = $dom->find('html title');
Find elements with CSS selectors and return a L<Mojo::Collection> object
containing these elements as L<Mojo::DOM> objects. All selectors from
Find all elements matching the CSS selector and return a L<Mojo::Collection>
object containing these elements as L<Mojo::DOM> objects. All selectors from
L<Mojo::DOM::CSS> are supported.
# Find a specific element and extract information
Expand All @@ -562,7 +563,8 @@ Find element namespace.
my $sibling = $dom->next;
Return L<Mojo::DOM> object for next sibling of element.
Return L<Mojo::DOM> object for next sibling of element or C<undef> if there
are no more siblings.
# "<h2>B</h2>"
$dom->parse('<div><h1>A</h1><h2>B</h2></div>')->at('h1')->next;
Expand All @@ -571,7 +573,8 @@ Return L<Mojo::DOM> object for next sibling of element.
my $parent = $dom->parent;
Return L<Mojo::DOM> object for parent of element.
Return L<Mojo::DOM> object for parent of element or C<undef> if this element
has no parent.
=head2 parse
Expand Down Expand Up @@ -604,7 +607,8 @@ Prepend to element content.
my $sibling = $dom->previous;
Return L<Mojo::DOM> object for previous sibling of element.
Return L<Mojo::DOM> object for previous sibling of element or C<undef> if
there are no more siblings.
# "<h1>A</h1>"
$dom->parse('<div><h1>A</h1><h2>B</h2></div>')->at('h2')->previous;
Expand Down

0 comments on commit 6da36db

Please sign in to comment.