Skip to content

How to create/insert comment node #190

Closed

Description

@shkarupa-alex

When using methods like node.replace_with("some text") it will create text node.
When using methods like node.replace_with(create_tag("div")) it will create element node.

But how can i create a comment node?

Activity

  1. rushter commented on Nov 25, 2025

    @rushter
    Owner

    It's not supported currently

  2. rushter commented on Nov 29, 2025

    @rushter
    Owner

    As a workaround, you can use the following code:

     LexborHTMLParser("<!-- test --!>", is_fragment=True).root
    

    You need to have the most recent version of selectolax.

  3. Repository owner locked and limited conversation to collaborators on Jan 1, 2026
  4. converted this issue into a discussion #208 on Jan 1, 2026
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions