Skip to content

remove() doesn't work on root elements in an html part #25

Description

@Defcon0

When doing the following, the div isn't removed from the html:

$objNode        = new HtmlPageCrawler('<div class="test"><p>Hallo</p></div>');
$objNode->filter('.test')->remove();

$x = $objNode->saveHTML();

When doing $objNode->filter('p')->remove(); the p-elements are correctly removed. Also when wrapping the div in another div it also works.

So it seems that I cannot remove root elements, can I? At least a hint in the comment would've been nice ;-) Maybe the bug can be fixed.

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