[CssSelector] added css selector with empty string
This commit is contained in:
parent
fc7a39ccd4
commit
dbafc2c365
@ -129,7 +129,7 @@ class Tokenizer
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = substr($s, $start, $next - $start);
|
$result = substr($s, $start, $next - $start);
|
||||||
if ('\\' === $result[strlen($result) - 1]) {
|
if (strlen($result) > 0 && '\\' === $result[strlen($result) - 1]) {
|
||||||
// next quote character is escaped
|
// next quote character is escaped
|
||||||
$pos = $next + 1;
|
$pos = $next + 1;
|
||||||
continue;
|
continue;
|
||||||
|
@ -34,6 +34,7 @@ class TokenizerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$this->assertEquals('foo[class=foo bar ]', $this->tokensToString($this->tokenizer->tokenize('foo[class="foo bar"]')), '->tokenize() lexes an input string and returns an array of tokens');
|
$this->assertEquals('foo[class=foo bar ]', $this->tokensToString($this->tokenizer->tokenize('foo[class="foo bar"]')), '->tokenize() lexes an input string and returns an array of tokens');
|
||||||
$this->assertEquals("foo[class=foo Abar ]", $this->tokensToString($this->tokenizer->tokenize('foo[class="foo \\65 bar"]')), '->tokenize() lexes an input string and returns an array of tokens');
|
$this->assertEquals("foo[class=foo Abar ]", $this->tokensToString($this->tokenizer->tokenize('foo[class="foo \\65 bar"]')), '->tokenize() lexes an input string and returns an array of tokens');
|
||||||
|
$this->assertEquals("img[alt= ]", $this->tokensToString($this->tokenizer->tokenize('img[alt=""]')), '->tokenize() lexes an input string and returns an array of tokens');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user