This commit is contained in:
yangxiuxiu 2025-07-01 11:03:51 +02:00 committed by GitHub
commit 471a3d1e19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 5 deletions

View File

@ -59,11 +59,11 @@ export function compatCoerceAttr(
): boolean { ): boolean {
if (isEnumeratedAttr(key)) { if (isEnumeratedAttr(key)) {
const v2CoercedValue = const v2CoercedValue =
value === null value === undefined
? 'false' ? null
: typeof value !== 'boolean' && value !== undefined : value === null || value === false || value === 'false'
? 'true' ? 'false'
: null : 'true'
if ( if (
v2CoercedValue && v2CoercedValue &&
compatUtils.softAssertCompatEnabled( compatUtils.softAssertCompatEnabled(

View File

@ -275,3 +275,17 @@ test('ATTR_ENUMERATED_COERCION', () => {
)('contenteditable', 'foo', 'true'), )('contenteditable', 'foo', 'true'),
).toHaveBeenWarned() ).toHaveBeenWarned()
}) })
test('ATTR_ENUMERATED_COERCION: true', () => {
const vm = new Vue({
compatConfig: { ATTR_ENUMERATED_COERCION: true },
template: `<div><div draggable="false">hello</div></div>`,
}).$mount()
expect(vm.$el.innerHTML).toBe(`<div draggable="false">hello</div>`)
expect(
(
deprecationData[DeprecationTypes.ATTR_ENUMERATED_COERCION]
.message as Function
)('draggable', 'false', 'false'),
).toHaveBeenWarned()
})