Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/runtime-dom/src/modules/attrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export function compatCoerceAttr(
}
} else if (
value === false &&
!(el.tagName === 'INPUT' && key === 'value') &&
!isSpecialBooleanAttr(key) &&
compatUtils.isCompatEnabled(DeprecationTypes.ATTR_FALSE_VALUE, instance)
) {
Expand Down
14 changes: 14 additions & 0 deletions packages/vue-compat/__tests__/misc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,20 @@ test('ATTR_FALSE_VALUE', () => {
).toHaveBeenWarned()
})

test('ATTR_FALSE_VALUE with false on input value', () => {
const vm = new Vue({
template: `<input :value="false"/>`,
}).$mount()
expect(vm.$el).toBeInstanceOf(HTMLInputElement)
expect(vm.$el.hasAttribute('value')).toBe(true)
expect(vm.$el.getAttribute('value')).toBe('false')
expect(
(deprecationData[DeprecationTypes.ATTR_FALSE_VALUE].message as Function)(
'value',
),
).not.toHaveBeenWarned()
})

test("ATTR_FALSE_VALUE with false value shouldn't throw warning", () => {
const vm = new Vue({
template: `<div :id="false" :foo="false"/>`,
Expand Down