Skip to content

Enable Keeping Attribute Name Casing #1128

@EisenbergEffect

Description

@EisenbergEffect

Some libraries/frameworks would like to use Parse5 in a way that preserves the casing of attribute names. A common use case for this is a templating engine that enables binding to custom events or JS properties (which natively allow for both lower and upper case).

As far as I can tell, this is controlled by the Tokenizer's _stateAttributeName method, which can be found here:

https://github.com/inikulin/parse5/blob/master/packages/parse5/lib/tokenizer/index.ts#L1673

Would it be possible to add a feature that tells this method to not lower case every letter?

Alternatively, is there a way to create a custom tokenizer that simply overrides this protected method with the altered behavior? If there is, I just need a code sample for that. Currently, I'm monkey patching the Tokenizer prototype directly, which I'd prefer not to do.

Thanks for the help!

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