Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions phpQuery/phpQuery/phpQueryObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ protected function pseudoClasses($class) {
if (! $param)
break;
// nth-child(n+b) to nth-child(1n+b)
if ($param{0} == 'n')
if ($param[0] == 'n')
$param = '1'.$param;
// :nth-child(index/even/odd/equation)
if ($param == 'even' || $param == 'odd')
Expand All @@ -1071,17 +1071,17 @@ protected function pseudoClasses($class) {
return null;'),
new CallbackParam(), $param
);
else if (mb_strlen($param) > 1 && $param{1} == 'n')
else if (mb_strlen($param) > 1 && $param[1] == 'n')
// an+b
$mapped = $this->map(
create_function('$node, $param',
'$prevs = pq($node)->prevAll()->size();
$index = 1+$prevs;
$b = mb_strlen($param) > 3
? $param{3}
? $param[3]
: 0;
$a = $param{0};
if ($b && $param{2} == "-")
$a = $param[0];
if ($b && $param[2] == "-")
$b = -$b;
if ($a > 0) {
return ($index-$b)%$a == 0
Expand Down
4 changes: 2 additions & 2 deletions phpQuery/phpQuery/plugins/WebBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function resolve_url($base, $url) {
// Step 3
if (preg_match('!^[a-z]+:!i', $url)) return $url;
$base = parse_url($base);
if ($url{0} == "#") {
if ($url[0] == "#") {
// Step 2 (fragment)
$base['fragment'] = substr($url, 1);
return unparse_url($base);
Expand All @@ -367,7 +367,7 @@ function resolve_url($base, $url) {
'scheme'=>$base['scheme'],
'path'=>substr($url,2),
));
} else if ($url{0} == "/") {
} else if ($url[0] == "/") {
// Step 5
$base['path'] = $url;
} else {
Expand Down