Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Find does not work with multiple attributes #317

Open
richard-wolsch opened this issue Jul 27, 2023 · 0 comments
Open

Find does not work with multiple attributes #317

richard-wolsch opened this issue Jul 27, 2023 · 0 comments

Comments

@richard-wolsch
Copy link

$dom->find(…) does not work with a CSS selector with multiple attributes.

Example:

        $testDom = new Dom();
        $testDom->loadStr('<div><input type="checkbox" name="color" value="blue"><input type="checkbox" name="color" value="red"></div>');
        $allCheckboxes = $testDom->find('input[name="color"]');
        echo count($allCheckboxes);  // 2 → that is fine
        $blueCheckbox = $testDom->find('input[name="color"][value="blue"]', 0);
        echo is_null($blueCheckbox); // true → Not good! I would expect the checkbox with value "blue" here.

Workaround: One could select just for the value $testDom->find('input[value="blue"]', 0); but this could of course find results with unwanted name-attributes too.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant