Skip to content

Commit 15208bd

Browse files
committed
shorten some lines, style fix
1 parent 8073f08 commit 15208bd

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/Rct567/DomQuery/CssToXpath.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ private static function transformCssPseudoSelector($expression, array &$new_path
304304
*/
305305
private static function transformAttrSelector($expression)
306306
{
307-
if (preg_match('|^([a-z0-9_]{1}[a-z0-9_-]*)(([\!\*\^\$\~\|]{0,1})=)?(?:[\'"]*)?([^\'"]+)?(?:[\'"]*)?$|i', $expression, $matches)) {
307+
if (preg_match('|^([a-z0-9_]{1}[a-z0-9_-]*)(([\!\*\^\$\~\|]{0,1})=)?'.
308+
'(?:[\'"]*)?([^\'"]+)?(?:[\'"]*)?$|i', $expression, $matches)) {
308309
if (!isset($matches[3])) { // attribute without value
309310
return "[@" . $matches[1] . "]";
310311
} elseif ($matches[3] === '') { // arbitrary attribute strict value equality

tests/Rct567/DomQuery/Tests/DomQuerySelectorsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function testCssToXpath()
1919
'#someid' => '//*[@id=\'someid\']',
2020
'p#someid' => '//p[@id=\'someid\']',
2121
'#some\\.id' => '//*[@id=\'some.id\']',
22-
'#someid.some-class' => '//*[@id=\'someid\'][contains(concat(\' \', normalize-space(@class), \' \'), \' some-class \')]',
22+
'#someid.s-class' => '//*[@id=\'someid\'][contains(concat(\' \', normalize-space(@class), \' \'), \' s-class \')]',
2323
'#id[_]' => '//*[@id=\'id\'][@_]',
2424
'p a' => '//p//a',
2525
'div, span' => '//div|//span',

0 commit comments

Comments
 (0)