Changeset 370
- Timestamp:
- 05/30/08 05:34:23 (4 months ago)
- Files:
-
- trunk/src/ingy/pQuery/Changes (modified) (1 diff)
- trunk/src/ingy/pQuery/README (modified) (1 diff)
- trunk/src/ingy/pQuery/lib/pQuery.pm (modified) (9 diffs)
- trunk/src/ingy/pQuery/t/contructors.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/ingy/pQuery/Changes
r356 r370 1 --- 2 version: 0.07 3 date: Fri May 30 05:31:03 PDT 2008 4 changes: 5 - Fixed some bugs reported by Simon Cozens. 6 https://rt.cpan.org/Ticket/Display.html?id=36104 7 - Fixed https://rt.cpan.org/Ticket/Display.html?id=34890 8 1 9 --- 2 10 version: 0.06 trunk/src/ingy/pQuery/README
r356 r370 130 130 Returns the version number of the pQuery module. 131 131 132 =size() 133 132 size() 134 133 Returns the number of elements in the pQuery object. 135 134 136 =length() 137 135 length() 138 136 Also returns the number of elements in the pQuery object. 139 137 trunk/src/ingy/pQuery/lib/pQuery.pm
r363 r370 10 10 use base 'Exporter'; 11 11 12 our $VERSION = '0.0 6';12 our $VERSION = '0.07'; 13 13 14 14 our $document; … … 69 69 if ($match and ($1 or not $context)) { 70 70 if ($1) { 71 $selector = [pQuery::DOM->fromHTML($1)]; 71 my $html = $this->_clean($1); 72 $selector = [pQuery::DOM->fromHTML($html)]; 72 73 # $selector = $this->_clean([$1], $context); 73 74 } … … 94 95 my $html = do {local $/; <FILE>}; 95 96 close FILE; 96 $html = ~ s/^\s*<!DOCTYPE\s.*?>\s*//s;97 $html = $this->_clean($html); 97 98 $selector = [$document = pQuery::DOM->fromHTML($html)]; 98 99 } … … 107 108 : $selector; 108 109 return $this; 110 } 111 112 sub _clean { 113 my ($this, $html) = @_; 114 $html =~ s/^\s*<\?xml\s.*?>\s*//s; 115 $html =~ s/^\s*<!DOCTYPE\s.*?>\s*//s; 116 return $html; 109 117 } 110 118 … … 685 693 686 694 for (my ($i, $rl) = (0, scalar(@$r)); $i < $rl; $i++) { 687 my ($a, $z) = ($r->[$i], $this->_props->[$m->[2]] || $m->[2]); 695 my $a = $r->[$i]; 696 my $z = $a->{($this->_props->{$m->[2]} || $m->[2])}; 688 697 689 698 if (not defined $z or $m->[2] =~ /href|src|selected/) { … … 692 701 693 702 if ( 694 ( 703 (( 695 704 $type eq "" and $z or 696 705 $type eq "=" and $z eq $m->[5] or … … 700 709 ($type eq "*=" or $type eq "~=") and 701 710 index($z, $m->[5]) >= 0 702 ) ^ $not711 ) ? 1 : 0) ^ ($not ? 1 : 0) 703 712 ) { push @$tmp, $a } 704 713 } … … 750 759 } 751 760 761 sub _props { 762 return { 763 for => "htmlFor", 764 class => "className", 765 # float => styleFloat, 766 # cssFloat => styleFloat, 767 # styleFloat => styleFloat, 768 innerHTML => "innerHTML", 769 className => "className", 770 value => "value", 771 disabled => "disabled", 772 checked => "checked", 773 readonly => "readOnly", 774 selected => "selected", 775 maxlength => "maxLength", 776 selectedIndex => "selectedIndex", 777 defaultValue => "defaultValue", 778 tagName => "tagName", 779 nodeName => "nodeName" 780 }; 781 } 782 752 783 ################################################################################ 753 784 # These methods need to go down here because they are Perl builtins. … … 1003 1034 Returns the version number of the pQuery module. 1004 1035 1005 = size()1036 =head2 size() 1006 1037 1007 1038 Returns the number of elements in the pQuery object. 1008 1039 1009 = length()1040 =head2 length() 1010 1041 1011 1042 Also returns the number of elements in the pQuery object. trunk/src/ingy/pQuery/t/contructors.t
r356 r370 52 52 is ref($pQuery), 'pQuery::DOM', '$pQuery is a DOM'; 53 53 is $pq->find('title')->text, 'Sample HTML Document', 'Document is correct'; 54 55
