Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DomCrawler] nth-last-child incorrect behavior #8068

Closed
@ghost

Description

$crawler = new Crawler('<html><body><ul id="test"><li>1</li><li>2</li><li>3</li></ul></body></html>');

echo "Text = " . $crawler->filter('ul#test li:nth-last-child(1)')->text();

This should output the number "3" (the last child), but instead outputs "2". (nth-last-child starts at index 1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions