Subject: | :not(a:contains('string')) returns malformed string in :contains |
Date: | Mon, 09 May 2016 14:28:47 +0000 |
To: | bug-HTML-Selector-XPath [...] rt.cpan.org |
From: | Michal Kos <kosmichal [...] gmail.com> |
Hello,
I noticed there's a problem with converting css selector to xpath if css
selector is :not(:contains('string'))
it seems like $rule trims the closing parenthesis ) so contains gets
"string" instead of "string")
at /usr/local/share/perl/5.14.2/HTML/Selector/XPath.pm line 212
Distribution name: HTML-Selector-XPath-0.18
Perl -v : This is perl 5, version 14, subversion 2 (v5.14.2) built for
x86_64-linux-gnu-thread-multi
Linux ... 3.2.0-4-amd64 #1 SMP Debian 3.2.73-2+deb7u2 x86_64 GNU/Linux
### code
#!/usr/bin/env perl
use strict;
use warnings;
use HTML::Selector::XPath 'selector_to_xpath';
my $s1 = 'a:contains("s1")';
my $s2 = ':not("s2")';
my $s3 = ':not(a:contains("s3"))';
#$s1=~s/\'/\"/g;
my $xpath = &selector_to_xpath($s1);
print $xpath;
print "\n";
my $xpath2 = &selector_to_xpath($s2);
print $xpath2;
print "\n";
my $xpath3 = &selector_to_xpath($s3);
print $xpath3;
print "\n";
### code
Thanks a lot
Best Regards,
Michal Kos