Skip to content

Empty Value Attribute Handling #75

Closed
@NiklasPor

Description

@NiklasPor

Hi all, great package, love it so far 🚀

I'm currently struggling with one problem tho: The HTML attributes that have no specific value, actually automatically get transformed to have a value of their own key.

I think this transformation is kinda weird, especially since the current HTML standard is specifying that the value of an empty attribute is actually an empty string, not a string that matches the name of the attribute:

image
https://html.spec.whatwg.org/multipage/syntax.html#attributes-2

Additionally, it breaks the behavior of some JS / HTML frameworks, which is a pity. Here's a quick example without any plugins installed:

Input

<div a b c="c"></div>

Expected

<div a b c="c"></div>

Output

<div c="c" a="a" b="b" other="other"></div>

I'd also be open to contributing and fixing this if it would be appreciated.

Kind regards
Niklas

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