We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
$dom = Document::loadHtml('' . '<ul class="a">' /**/ . '<li>a1</li>' /**/ . '<li>' /****/ . '<ul class="b">' /******/ . '<li>b1</li>' /******/ . '<li>b2</li>' /****/ . '</ul>' /**/ . '</li>' /**/ . '<li>a2</li>' /**/ . '<li>' /****/ . '<ul class="b">' /******/ . '<li>b3</li>' /******/ . '<li>b4</li>' /****/ . '</ul>' /**/ . '</li>' . '</ul>' ); echo count($dom->find('ul li')) . PHP_EOL; // 8, ok echo count($dom->find('ul > li')) . PHP_EOL; // 8, ok echo count($dom->find('ul.a > li')) . PHP_EOL; // 4, ok echo count($dom->find('ul.b > li')) . PHP_EOL; // 4, ok $dom = Document::loadHtml('' . '<ul class="a">' /**/ . '<li>a1</li>' /**/ . '<li>' /* -- `ul` was removed -- */ /******/ . '<li>b1</li>' /******/ . '<li>b2</li>' /* -- `ul` was removed -- */ /**/ . '</li>' /**/ . '<li>a2</li>' /**/ . '<li>' /* -- `ul` was removed -- */ /******/ . '<li>b3</li>' /******/ . '<li>b4</li>' /* -- `ul` was removed -- */ /**/ . '</li>' . '</ul>' ); echo count($dom->find('ul li')) . PHP_EOL; // 8, ok echo count($dom->find('ul > li')) . PHP_EOL; // 8, what ? echo count($dom->find('ul > li > li')) . PHP_EOL; // 0, what ?
The text was updated successfully, but these errors were encountered:
One more example:
$dom = Document::loadHtml('' . '<ul class="a">' /**/ . '<li>a1</li>' /**/ . '<li>' /* -- `ul` was removed -- */ /******/ . '<li>b1</li>' /******/ . '<li>b2</li>' /* -- `ul` was removed -- */ /**/ . '</li>' /**/ . '<li>a2</li>' /**/ . '<li>' /* -- `ul` was removed -- */ /******/ . '<li>b3</li>' /******/ . '<li>b4</li>' /* -- `ul` was removed -- */ /**/ . '</li>' . '</ul>' ); $domLi = $dom->find('li', -3); $this->assertEquals('<li><li>b3</li><li>b4</li></li>', $domLi); // fails :( equals '<li>' without closing tag
Sorry, something went wrong.
One more example. Thats all about the parser. Sorry me.
$document = Document::loadHtml('' . '<div>' /**/ . '<a href="#">2020 < </a>' /**/ . '<a href="#">2020 < </a>' . '</div>' ); $domDiv = $document->find('div', 0); dd(array_map('strval', $domDiv->children())); // array:2 [ 0 => "2020 <", 1 => "2020" ] // what? where's the outerhtml of each? why only textNodes?
No branches or pull requests
The text was updated successfully, but these errors were encountered: