Skip to content

SVG minifier broken for e.g. AlpineJS bindings #936

@bep

Description

@bep

See this commit: 13196ae

An AlpineJS svg construct may look like this:

<svg>
  <use x-bind:href="myicon">
</svg>

Or:

<svg>
  <use :href="myicon">
</svg>

Both of which gets stripped away.

I don't think it's uncommon for dynamic JS libraries to use namespaced attribute prefixes like this.

EDIT IN: As to a suggested fix that's both relatively simple and would also make the original inkscape user happy:

I think my uses of this vs svg boils down to this example:

<svg :id="myid" :class="myclass">
  <use :href="myicon">
</svg>
  • So by doing a colon := bytes.IndexByte(t.Text, ':'); colon > 0 would work for my uses.
  • Also, if you added a whitelist check that also allowed for foo:class and some other common attributes, that would be great.

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