Skip to content

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

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

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions