Skip to content

when searching for child returns child and texts #15

@fatasy

Description

@fatasy

When I search for tr td: nth-child (1) returns all elements and when I search for tr td [1] does not return anything, am I doing something wrong here? with PhpSimple works normal.

$dom = new Dom;
$dom->load('HTML TABLE');
$tds =  $dom->find('tr td:nth-child(1)');

Returns
desktop screenshot 2018 12 10 - 02 21 18 71

with
$tds = $dom->find('tr td[1]');
returns nothing.

I edited the file Selector.php, I added this after line 172

$return = [];

after line 185

$nth = $node->find($rule['tag'], $rule['key']);
if ($nth) {
   $return[] = $nth;
}

and line 188 of

return []; 

to

return $return; 

and now works with tr td[1] selector

Does not this selector work or am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions