@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | $this->functionSet = $functionSet; |
21 | 21 | |
22 | 22 | $this->translators = [ |
23 | - ' ' => function($string) use ($prefix) { return '//' . $prefix . $string; }, |
|
24 | - '' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
25 | - '>' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
26 | - '#' => function($string) { return '[@id=\'' . $string . '\']'; }, |
|
27 | - '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' ' . $string . ' \')]'; }, |
|
28 | - '[' => function($string) use ($hash) { return '[' .'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \'' . $string . '\', ., "' . $hash . '")' . ']'; }, |
|
23 | + ' ' => function($string) use ($prefix) { return '//'.$prefix.$string; }, |
|
24 | + '' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
25 | + '>' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
26 | + '#' => function($string) { return '[@id=\''.$string.'\']'; }, |
|
27 | + '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' '.$string.' \')]'; }, |
|
28 | + '[' => function($string) use ($hash) { return '['.'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \''.$string.'\', ., "'.$hash.'")'.']'; }, |
|
29 | 29 | ']' => function() { return ''; } |
30 | 30 | ]; |
31 | 31 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if (strpos($attr, $comparator) !== false) { |
54 | 54 | $parts = explode($comparator, $attr); |
55 | 55 | |
56 | - return $valueParser->parse('attr(' . $parts[0] . ')' . $comparator . $parts[1])[0]; |
|
56 | + return $valueParser->parse('attr('.$parts[0].')'.$comparator.$parts[1])[0]; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | return $element[0]->getAttribute($attr) !== ''; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function getXpath($css) { |
80 | - $this->css = str_replace([' >', '> '],['>', '>'], trim($css)); |
|
80 | + $this->css = str_replace([' >', '> '], ['>', '>'], trim($css)); |
|
81 | 81 | $css = explode(':', $this->css)[0]; |
82 | 82 | $selectors = $this->split($css); |
83 | 83 | $xpath = '/'; |