Skip to content

Commit 236b9a1

Browse files
committed
Fixed issue with selector on top level items
1 parent 318d02b commit 236b9a1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/PHPHtmlParser/Selector.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,8 @@ protected function parseSelectorString($selector)
169169
protected function seek(array $nodes, array $rule, array $options)
170170
{
171171
// XPath index
172-
if ($rule['tag'] instanceof Countable &&
173-
count($rule['tag']) > 0 &&
174-
$rule['key'] instanceof Countable &&
175-
count($rule['key']) > 0 &&
172+
if (array_key_exists('tag', $rule) &&
173+
array_key_exists('key', $rule) &&
176174
is_numeric($rule['key'])
177175
) {
178176
$count = 0;

0 commit comments

Comments
 (0)