Changeset 358
- Timestamp:
- 04/30/08 21:47:01 (2 weeks ago)
- Files:
-
- trunk/src/ingy/pQuery/lib/pQuery/DOM.pm (modified) (1 diff)
- trunk/src/ingy/pQuery/t/dom.t (modified) (2 diffs)
- trunk/src/ingy/pQuery/t/selectors.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/ingy/pQuery/lib/pQuery/DOM.pm
r356 r358 160 160 my $found = []; 161 161 _find($self, $found, sub { $_->{_tag} eq $tag or $tag eq "*" }); 162 shift @$found if @$found and $found->[0] == $self; 162 163 return $found; 163 164 } trunk/src/ingy/pQuery/t/dom.t
r355 r358 1 use t::TestpQuery tests => 3 3;1 use t::TestpQuery tests => 35; 2 2 3 use pQuery; 3 4 use pQuery::DOM; 4 5 … … 83 84 is $div->toHTML, '<div id="new-div" class="classy">Foo<!--I am remarkable--></div>', 84 85 'createElement, createComment and appendChild work'; 86 87 my $body = pQuery('t/document1.html')->find('body')->get(0); 88 my $star = $body->getElementsByTagName('*'); 89 is scalar(@$star), 10, 'Find all nodes'; 90 is $star->[0]->tagName, 'H2', '* finds correct things'; 91 trunk/src/ingy/pQuery/t/selectors.t
r356 r358 5 5 pQuery('t/spreadily.html'); 6 6 7 # is pQuery('*')->size, 30, '* finds all'; 8 # exit; 7 9 is pQuery('h3')->text, 'The Intarweb is a Spreadsheet!', 8 10 'select an element by tag name';
