Skip to content

Underscores in the start of the attribute name cause them to be removed #355

@slickdomi

Description

@slickdomi

HTML5 specification is not disallowing special characters to be the start of the attribute name but java-html-sanitizer removes any attribute that has a name that starts with a different character than letters. This can't be bypassed by the .allowAttributes('__foo').

According to the HTML standard "before attribute name state" underscores (and many other characters) should be added to the beginning of the new attribute name https://html.spec.whatwg.org/#before-attribute-name-state

This creates problems for functionalities of react/lexical editor that defaults to double underscore as the prefix for their attributes names https://lexical.dev/docs/concepts/nodes#node-properties

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions