Skip to content

Commit

Permalink
fast fix for :nth-child(n)
Browse files Browse the repository at this point in the history
  • Loading branch information
positronium committed Dec 9, 2013
1 parent 3d72788 commit e44735c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nokogiri.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ public function getXpathSubquery($expression, $rel = false, $compile = true){
$brackets[] = '(position() -1) mod 2 = 0 and position() >= 1';
}elseif('even' === $e){
$brackets[] = 'position() mod 2 = 0 and position() >= 0';
}elseif(preg_match("/^[0-9]+$/", $e)){
$brackets[] = 'position() = '.$e;
}elseif(preg_match("/^((?P<mul>[0-9]+)n\+)(?P<pos>[0-9]+)$/is", $e, $esubs)){
if (isset($esubs['mul'])){
$brackets[] = '(position() -'.$esubs['pos'].') mod '.$esubs['mul'].' = 0 and position() >= '.$esubs['pos'].'';
Expand Down

0 comments on commit e44735c

Please sign in to comment.