Skip to content
New issue

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

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

Already on GitHub? Sign in 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.

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

No branches or pull requests

1 participant