Attribute collision when one is bound and the other is not (using : shortand and not v-bind)
See original GitHub issueI upgraded my dependencies and I have some issues with the latest version (1.4.6). By testing the older releases, it appears that the bug got introduced on version 1.3.0 (1.2.18 works fine).
My code:
<img
svg-inline
src="../../assets/icon.svg"
class="fill-current menu-icon"
:class="{ 'text-red-900': !active }"
/>
Expected output: <svg>
tag with at least the static classes (fill-current menu-icon
)
Instead I get: the static part is removed, only the :class
part is respected (
)
Interestingly, if I make a trivial modification to the class (add a whitespace for instance), the hot-reload injects the updated static classes and everything looks fine again.
Furthermore, if I replace :class
with v-bind:class
- on v1.3.0, everything seems to be fine
- on v1.4.6 the compilation fails with
duplicate attribute: v-bind:class
Probably relevant commit: https://github.com/oliverfindl/vue-svg-inline-loader/commit/f5f0a0ff1b44f5de9381f70c991089892901ef99 (#28)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
How can I solve "Interpolation inside attributes has been ...
Vue template syntax error: id="purchase-{{ item.id }}": Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead.
Read more >Binding syntax - Angular
Data binding works with properties of DOM elements, components, and directives, not HTML attributes. HTML attributes and DOM propertieslink. Angular binding ...
Read more >Shorthands for Events and Bindings in Vue - Coding Explained -
The shorthand for this directive is simply a colon followed by the name of the attribute to bind to. In this case, we...
Read more >GDScript basics - Godot Docs
Saves a variable along with the resource it's attached to and makes it visible ... null is an empty data type that contains...
Read more >Hibernate ORM 5.4.33.Final User Guide - Red Hat on GitHub
While having a strong background in SQL is not required to use Hibernate, ... is another form of a value type, and its...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello,
I updated loader and published it to npm. Current version is 1.5.0.
You can turn off transformation to
v-bind:
syntax with transformImageAttributesToVueDirectives option.Please give me feedback if it works as expected.
Thanks
An easier workaround (without change to my CSS) is to manually merge my static
class
inside my bounded:class
: