Skip to content

Find does not work with multiple attributes #317

Description

@richard-wolsch

$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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions