[CssSelector] removed an unneeded condition (taken care of afterward in the code) (closes #4269)
This commit is contained in:
parent
cbc3ed36b9
commit
d34383f10b
@ -250,11 +250,6 @@ class FunctionNode implements NodeInterface
|
|||||||
return array(0, 0);
|
return array(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($s)) {
|
|
||||||
// Happens when you just get a number
|
|
||||||
return array(0, $s);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('odd' == $s) {
|
if ('odd' == $s) {
|
||||||
return array(2, 1);
|
return array(2, 1);
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,11 @@ class FunctionNodeTest extends \PHPUnit_Framework_TestCase
|
|||||||
$function = new FunctionNode($element, ':', 'nth-child', $element2);
|
$function = new FunctionNode($element, ':', 'nth-child', $element2);
|
||||||
$this->assertEquals("*/*[name() = 'h1' and (position() >= 1)]", (string) $function->toXpath(), '->toXpath() returns the xpath representation of the node');
|
$this->assertEquals("*/*[name() = 'h1' and (position() >= 1)]", (string) $function->toXpath(), '->toXpath() returns the xpath representation of the node');
|
||||||
|
|
||||||
|
// h1:nth-child(1)
|
||||||
|
$element2 = new ElementNode('*', new Token('Symbol', '2', -1));
|
||||||
|
$function = new FunctionNode($element, ':', 'nth-child', $element2);
|
||||||
|
$this->assertEquals("*/*[name() = 'h1' and (position() = 2)]", (string) $function->toXpath(), '->toXpath() returns the xpath representation of the node');
|
||||||
|
|
||||||
// h1:nth-child(2n)
|
// h1:nth-child(2n)
|
||||||
$element2 = new ElementNode('*', new Token('Symbol', '2n', -1));
|
$element2 = new ElementNode('*', new Token('Symbol', '2n', -1));
|
||||||
$function = new FunctionNode($element, ':', 'nth-child', $element2);
|
$function = new FunctionNode($element, ':', 'nth-child', $element2);
|
||||||
|
Reference in New Issue
Block a user