Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #5 from kamelkev/master

Update pseudo-class support to reject CSS3 type double-colon selectors, ...
  • Loading branch information...
commit 78ad93ab09d6ce4d43611bcc0ec1751f323e9d11 2 parents f2a5353 + 2a597a0
@kamelkev kamelkev authored
Showing with 23 additions and 10 deletions.
  1. +5 −0 ChangeLog
  2. +3 −3 lib/HTML/Query.pm
  3. +15 −7 t/pseudoclasses.t
View
5 ChangeLog
@@ -61,3 +61,8 @@
- Adds tests for verifying specificity calculation and proper selection of -child pseudo classes
* Updated documentation with sections for pseudo-classes and psuedo-elements detailing
current support for those features.
+
+0.09 2014-08-27 Kevin Kamel <kamelkev@mailermailer.com>
+ * Add proper filtering for CSS3 double-colon psuedo-selectors
+ - Update pseudo-class test to exercise updated filtering regex
+ * Correct typo within documentation
View
6 lib/HTML/Query.pm
@@ -1,6 +1,6 @@
package HTML::Query;
-our $VERSION = '0.08';
+our $VERSION = '0.09';
use Badger::Class
version => $VERSION,
@@ -272,7 +272,7 @@ sub query {
}
}
# and/or one or more pseudo-classes
- if ($query =~ / \G : ([\w\-]+) /cgx) {
+ if ($query =~ / \G : :? ([\w\-]+) /cgx) {
my $pseudoclass = $1;
$specificity += 10;
@@ -1122,7 +1122,7 @@ of a browser context due to their dynamic nature.
Unsupported.
-Functionality for the :lang psuedo-class is largely replicated by using an
+Functionality for the :lang pseudo-class is largely replicated by using an
attribute selector for lang combined with a universal selector query.
If this is insufficient I'd love to see a patch adding support for it.
View
22 t/pseudoclasses.t
@@ -4,7 +4,7 @@ use lib qw( ./lib ../lib );
use HTML::TreeBuilder;
use Badger::Filesystem '$Bin Dir';
use Badger::Test
- tests => 10,
+ tests => 14,
debug => 'HTML::Query',
args => \@ARGV;
@@ -29,14 +29,22 @@ my $test1 = $query->query('table td:first-child');
is( $test1->size, 3, 'test1 - size' );
is( join(" | ", $test1->as_trimmed_text), "1,1 | 2,1 | 3,1", 'test1 - text');
-my $test2 = $query->query('table td:last-child');
+my $test2 = $query->query('table td:first-child');
is( $test2->size, 3, 'test2 - size' );
-is( join(" | ", $test2->as_trimmed_text), "1,3 | 2,3 | 3,3", 'test2 - text');
+is( join(" | ", $test2->as_trimmed_text), "1,1 | 2,1 | 3,1", 'test2 - text');
-my $test3 = $query->query('table tr:first-child td');
+my $test3 = $query->query('table td:last-child');
is( $test3->size, 3, 'test3 - size' );
-is( join(" | ", $test3->as_trimmed_text), "1,1 | 1,2 | 1,3", 'test3 - text');
+is( join(" | ", $test3->as_trimmed_text), "1,3 | 2,3 | 3,3", 'test3 - text');
-my $test4 = $query->query('table tr:last-child td');
+my $test4 = $query->query('table tr:first-child td');
is( $test4->size, 3, 'test4 - size' );
-is( join(" | ", $test4->as_trimmed_text), "3,1 | 3,2 | 3,3", 'test4 - text');
+is( join(" | ", $test4->as_trimmed_text), "1,1 | 1,2 | 1,3", 'test4 - text');
+
+my $test5 = $query->query('table tr:last-child td');
+is( $test5->size, 3, 'test5 - size' );
+is( join(" | ", $test5->as_trimmed_text), "3,1 | 3,2 | 3,3", 'test5 - text');
+
+my $test6 = $query->query('table tr::last-child td');
+is( $test6->size, 3, 'test6 - size' );
+is( join(" | ", $test6->as_trimmed_text), "3,1 | 3,2 | 3,3", 'test6 - text');
Please sign in to comment.
Something went wrong with that request. Please try again.