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

Suitability question: are relative selectors supported? #52

Open
rulatir opened this issue Mar 18, 2024 · 0 comments
Open

Suitability question: are relative selectors supported? #52

rulatir opened this issue Mar 18, 2024 · 0 comments

Comments

@rulatir
Copy link

rulatir commented Mar 18, 2024

use DOMWrap\Document;

$html = <<<HTML
<ul>
    <li>
        <div>
            <p>Outer 1</p>
            <ul>
                <li>Inner</li>
            </ul>
        </div>
    </li>
    <li>Outer 2</li>
    <li>Outer 3</li>
</ul>
HTML;

$doc = new Document();
$doc->html($html);

// Accepts this selector, or errors out?
$nodes = $doc->find('> li');

// Or maybe this one, which is more standard?
$node = $doc->find(':scope > li');

// Returns '3' or '4'?
var_dump($nodes->count());
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