|
|
@@ -36,7 +36,21 @@ export function patchStyle(el: Element, prev: Style, next: Style): void {
|
|
|
if (key === 'display') {
|
|
|
hasControlledDisplay = true
|
|
|
}
|
|
|
- setStyle(style, key, next[key])
|
|
|
+ const value = next[key]
|
|
|
+ if (value != null) {
|
|
|
+ if (
|
|
|
+ !shouldPreserveTextareaResizeStyle(
|
|
|
+ el,
|
|
|
+ key,
|
|
|
+ !isString(prev) && prev ? prev[key] : undefined,
|
|
|
+ value,
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ setStyle(style, key, value)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ setStyle(style, key, '')
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
if (isCssString) {
|
|
|
@@ -123,3 +137,22 @@ function autoPrefix(style: CSSStyleDeclaration, rawName: string): string {
|
|
|
}
|
|
|
return rawName
|
|
|
}
|
|
|
+
|
|
|
+/**
|
|
|
+ * Browsers update textarea width/height directly during native resize.
|
|
|
+ * Only special-case this common textarea path for now; other resize scenarios
|
|
|
+ * still follow normal vnode style patching.
|
|
|
+ */
|
|
|
+function shouldPreserveTextareaResizeStyle(
|
|
|
+ el: Element,
|
|
|
+ key: string,
|
|
|
+ prev: string | string[] | undefined,
|
|
|
+ next: string | string[],
|
|
|
+): boolean {
|
|
|
+ return (
|
|
|
+ el.tagName === 'TEXTAREA' &&
|
|
|
+ (key === 'width' || key === 'height') &&
|
|
|
+ isString(next) &&
|
|
|
+ prev === next
|
|
|
+ )
|
|
|
+}
|