Skip to content

Support single-quoted attribute values #143

@umajho

Description

@umajho

It would be nice to support using single quotes instead of double quotes to surround attribute values.

For example, if I put a JSON string in an attribute, the render result can be filled with "s:

<!-- total: 1826 bytes; `&quot;`s: 888 bytes (~48.63% of total). -->
<x-foo-table class="x h-full" foos="[{&quot;id&quot;:379338656,&quot;name&quot;:&quot;******&quot;,&quot;type&quot;:&quot;general&quot;,&quot;createdAt&quot;:&quot;2025-08-08T20:17:39.663373Z&quot;,&quot;note&quot;:&quot;test&quot;},{&quot;id&quot;:141015513,&quot;name&quot;:&quot;******&quot;,&quot;type&quot;:&quot;general&quot;,&quot;createdAt&quot;:&quot;2025-08-08T21:59:38.912249Z&quot;},{&quot;id&quot;:158390610,&quot;name&quot;:&quot;******&quot;,&quot;type&quot;:&quot;creation_dedicated&quot;,&quot;createdAt&quot;:&quot;2025-08-08T22:01:50.388961Z&quot;},{&quot;id&quot;:394389570,&quot;name&quot;:&quot;******&quot;,&quot;type&quot;:&quot;creation_dedicated&quot;,&quot;createdAt&quot;:&quot;2025-08-08T22:01:55.365973Z&quot;},{&quot;id&quot;:974399273,&quot;name&quot;:&quot;******&quot;,&quot;type&quot;:&quot;creation_dedicated&quot;,&quot;createdAt&quot;:&quot;2025-08-08T22:05:20.970877Z&quot;},{&quot;id&quot;:17757763,&quot;name&quot;:&quot;******&quot;,&quot;type&quot;:&quot;creation_dedicated&quot;,&quot;createdAt&quot;:&quot;2025-08-08T22:05:22.365469Z&quot;},{&quot;id&quot;:1729396425,&quot;name&quot;:&quot;******&quot;,&quot;type&quot;:&quot;creation_dedicated&quot;,&quot;createdAt&quot;:&quot;2025-08-08T22:05:23.820177Z&quot;},{&quot;id&quot;:1392435214,&quot;name&quot;:&quot;******&quot;,&quot;type&quot;:&quot;creation_dedicated&quot;,&quot;createdAt&quot;:&quot;2025-08-08T22:05:25.439Z&quot;},{&quot;id&quot;:1338106766,&quot;name&quot;:&quot;******&quot;,&quot;type&quot;:&quot;creation_dedicated&quot;,&quot;createdAt&quot;:&quot;2025-08-08T22:01:56.884257Z&quot;,&quot;note&quot;:&quot;x&quot;},{&quot;id&quot;:1689333865,&quot;name&quot;:&quot;******&quot;,&quot;type&quot;:&quot;creation_dedicated&quot;,&quot;createdAt&quot;:&quot;2025-08-09T07:52:19.403957Z&quot;}]"></x-foo-table>

If I switch to using single quotes, the result is much clearer:

<!-- total: 1086 bytes. -->
<x-foo-table class='x h-full' foos='[{"id":379338656,"name":"******","type":"general","createdAt":"2025-08-08T20:17:39.663373Z","note":"test"},{"id":141015513,"name":"******","type":"general","createdAt":"2025-08-08T21:59:38.912249Z"},{"id":158390610,"name":"******","type":"creation_dedicated","createdAt":"2025-08-08T22:01:50.388961Z"},{"id":394389570,"name":"******","type":"creation_dedicated","createdAt":"2025-08-08T22:01:55.365973Z"},{"id":974399273,"name":"******","type":"creation_dedicated","createdAt":"2025-08-08T22:05:20.970877Z"},{"id":17757763,"name":"******","type":"creation_dedicated","createdAt":"2025-08-08T22:05:22.365469Z"},{"id":1729396425,"name":"******","type":"creation_dedicated","createdAt":"2025-08-08T22:05:23.820177Z"},{"id":1392435214,"name":"******","type":"creation_dedicated","createdAt":"2025-08-08T22:05:25.439Z"},{"id":1338106766,"name":"******","type":"creation_dedicated","createdAt":"2025-08-08T22:01:56.884257Z","note":"x"},{"id":1689333865,"name":"******","type":"creation_dedicated","createdAt":"2025-08-09T07:52:19.403957Z"}]'></x-foo-table>

Maybe this behavior can be enabled with a new feature flag like single-quoted-attributes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions