From: 某时橙 <1163675107@qq.com> Date: Tue, 27 Sep 2022 09:18:29 +0000 (+0800) Subject: fix(compiler-dom): remove v-bind boolean attribute with literal false value when... X-Git-Tag: v3.2.40~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c6fe2c0cd89ce513503b1f85e0ddb696fd81e54;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-dom): remove v-bind boolean attribute with literal false value when stringifying (#6635) fix #6617 --- diff --git a/packages/compiler-dom/__tests__/transforms/stringifyStatic.spec.ts b/packages/compiler-dom/__tests__/transforms/stringifyStatic.spec.ts index c737071a82..bedec9fc00 100644 --- a/packages/compiler-dom/__tests__/transforms/stringifyStatic.spec.ts +++ b/packages/compiler-dom/__tests__/transforms/stringifyStatic.spec.ts @@ -410,6 +410,29 @@ describe('stringify static html', () => { }) }) + // #6617 + test('should remove boolean attribute for `false`', () => { + const { ast } = compileWithStringify( + `${repeat( + `
`, + StringifyThresholds.NODE_COUNT + )}` + ) + expect(ast.hoists[0]).toMatchObject({ + type: NodeTypes.JS_CALL_EXPRESSION, + callee: CREATE_STATIC, + arguments: [ + JSON.stringify( + `${repeat( + ``, + StringifyThresholds.NODE_COUNT + )}` + ), + '21' + ] + }) + }) + test('should stringify svg', () => { const svg = `