From 1ed69fa0f2b54eb1a2b4931e9c4227ea7c09d720 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Fri, 31 Mar 2023 01:41:49 +0900 Subject: [PATCH] refactor --- src/compiler/compile/render_ssr/handlers/Element.ts | 4 ++-- .../handlers/shared/get_attribute_value.ts | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/compiler/compile/render_ssr/handlers/Element.ts b/src/compiler/compile/render_ssr/handlers/Element.ts index 80557f4291..d9254a7b86 100644 --- a/src/compiler/compile/render_ssr/handlers/Element.ts +++ b/src/compiler/compile/render_ssr/handlers/Element.ts @@ -63,7 +63,7 @@ export default function (node: Element, renderer: Renderer, options: RenderOptio const attr_name = node.namespace === namespaces.foreign ? attribute.name : fix_attribute_casing(attribute.name); const name = attribute.name.toLowerCase(); if (name === 'value' && node.name.toLowerCase() === 'textarea') { - node_contents = get_attribute_value(attribute, true); + node_contents = get_attribute_value(attribute); } else if (attribute.is_true) { args.push(x`{ ${attr_name}: true }`); } else if ( @@ -90,7 +90,7 @@ export default function (node: Element, renderer: Renderer, options: RenderOptio const name = attribute.name.toLowerCase(); const attr_name = node.namespace === namespaces.foreign ? attribute.name : fix_attribute_casing(attribute.name); if (name === 'value' && node.name.toLowerCase() === 'textarea') { - node_contents = get_attribute_value(attribute, true); + node_contents = get_attribute_value(attribute); } else if (attribute.is_true) { renderer.add_string(` ${attr_name}`); } else if ( diff --git a/src/compiler/compile/render_ssr/handlers/shared/get_attribute_value.ts b/src/compiler/compile/render_ssr/handlers/shared/get_attribute_value.ts index 2c5b4ae157..dca2cde201 100644 --- a/src/compiler/compile/render_ssr/handlers/shared/get_attribute_value.ts +++ b/src/compiler/compile/render_ssr/handlers/shared/get_attribute_value.ts @@ -16,13 +16,16 @@ export function get_class_attribute_value(attribute: Attribute): ESTreeExpressio return get_attribute_value(attribute); } -/** - * For value attribute of textarea, it will render as child node of `