Setting boolean, hyphenated attribute on a vue custom-element to null does not remove the attribute in the HTML document #12139
Labels
🔨 p3-minor-bug
Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.
scope: custom elements
Vue version
3.5.11
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-bayiek?file=src%2FApp.vue
Steps to reproduce
Run the StackBlitz reproduction project.
It tries multiple ways to set boolean attributes on vue custom-elements and native custom-elements:
What is expected?
should set or remove both non-hyphenated and hyphenated attributes in the HTML document accordingly.
What is actually happening?
updates the non-hyphenated attribute correctly, but the hyphenated attribute is always set to
foo-bar=""
in the HTML document, which is interpreted astrue
.sets both attributes correctly on vue custom-elements, but
sets both attributes to either
"true"
or"false"
in the HTML document, which is always interpreted astrue
by the native custom-element because the attribute is present.This is problematic because now we need to differentiate between custom-elements created with vue and native custom elements. According to Vue's documentation, attributes that are set to
null
orundefined
should be removed in the HTML document. So I would expectto create
in the HTML document when
booleanValue
isfalse
.System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: