mirror of
https://github.com/marko-js/marko.git
synced 2026-01-25 15:03:04 +00:00
fix: text area null regression
This commit is contained in:
parent
bb250c9bd5
commit
ccc19e2657
5
.changeset/selfish-bananas-exercise.md
Normal file
5
.changeset/selfish-bananas-exercise.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"marko": patch
|
||||
---
|
||||
|
||||
Fix regression where a textarea created with no value in the browser was setting `null` as the value.
|
||||
@ -116,7 +116,7 @@ function VElement(
|
||||
this.___attributes = attrs || EMPTY_OBJECT;
|
||||
this.___properties = props || EMPTY_OBJECT;
|
||||
this.___nodeName = tagName;
|
||||
this.___valueInternal = null;
|
||||
this.___valueInternal = "";
|
||||
this.___constId = constId;
|
||||
this.___preserve = false;
|
||||
this.___preserveBody = false;
|
||||
|
||||
@ -50,8 +50,7 @@ VNode.prototype = {
|
||||
|
||||
if (this.___nodeName === "textarea") {
|
||||
if (child.___Text) {
|
||||
var childValue = child.___nodeValue;
|
||||
this.___valueInternal = (this.___valueInternal || "") + childValue;
|
||||
this.___valueInternal += child.___nodeValue;
|
||||
} else {
|
||||
throw TypeError();
|
||||
}
|
||||
|
||||
@ -696,10 +696,8 @@ function morphdom(fromNode, toNode, host, componentsContext) {
|
||||
}
|
||||
|
||||
if (nodeName === "textarea") {
|
||||
var newValue = toEl.___valueInternal || "";
|
||||
var oldValue = vFromEl.___valueInternal || "";
|
||||
if (oldValue !== newValue) {
|
||||
fromEl.value = newValue;
|
||||
if (toEl.___valueInternal !== vFromEl.___valueInternal) {
|
||||
fromEl.value = toEl.___valueInternal;
|
||||
}
|
||||
} else {
|
||||
morphChildren(fromEl, toEl, parentComponent);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user