[CssSelector] removed an unneeded condition (taken care of afterward in the code) (closes #4269)

This commit is contained in:
Fabien Potencier 2012-05-12 20:35:16 +02:00
parent cbc3ed36b9
commit d34383f10b
2 changed files with 5 additions and 5 deletions

View File

@ -250,11 +250,6 @@ class FunctionNode implements NodeInterface
return array(0, 0);
}
if (is_string($s)) {
// Happens when you just get a number
return array(0, $s);
}
if ('odd' == $s) {
return array(2, 1);
}

View File

@ -58,6 +58,11 @@ class FunctionNodeTest extends \PHPUnit_Framework_TestCase
$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');
// 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)
$element2 = new ElementNode('*', new Token('Symbol', '2n', -1));
$function = new FunctionNode($element, ':', 'nth-child', $element2);