Skip to content

Commit

Permalink
show all node types
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 21, 2015
1 parent 6998ff3 commit fdd6933
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

6.21 2015-09-19
6.21 2015-09-21

6.20 2015-09-15
- Deprecated Mojo::UserAgent::CookieJar::collecting in favor of
Expand Down
24 changes: 24 additions & 0 deletions lib/Mojo/DOM.pm
Expand Up @@ -902,6 +902,30 @@ carefully since it is very dynamic.
This node's type, usually C<cdata>, C<comment>, C<doctype>, C<pi>, C<raw>,
C<root>, C<tag> or C<text>.
# "cdata"
$dom->parse('<![CDATA[Test]]>')->child_nodes->first->type;
# "comment"
$dom->parse('<!-- Test -->')->child_nodes->first->type;
# "doctype"
$dom->parse('<!DOCTYPE html>')->child_nodes->first->type;
# "pi"
$dom->parse('<?xml version="1.0"?>')->child_nodes->first->type;
# "raw"
$dom->parse('<title>Test</title>')->at('title')->child_nodes->first->type;
# "root"
$dom->parse('<p>Test</p>')->type;
# "tag"
$dom->parse('<p>Test</p>')->at('p')->type;
# "text"
$dom->parse('<p>Test</p>')->at('p')->child_nodes->first->type;
=head2 wrap
$dom = $dom->wrap('<div></div>');
Expand Down

0 comments on commit fdd6933

Please sign in to comment.