Skip to content

Commit

Permalink
πŸ› Fix setting value not working server-side on <textarea> elements
Browse files Browse the repository at this point in the history
  • Loading branch information
skerit committed Feb 4, 2024
1 parent 1d95820 commit f65b489
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Improve printed error messages during rendering
* Actually update the `hawkejs.scene.exposed` values after receiving new data from the server
* Fix custom-element render issue with overlaying variable instances
* Fix setting `value` not working server-side on `<textarea>` elements

## 2.3.15 (2023-11-27)

Expand Down
12 changes: 9 additions & 3 deletions lib/dom/html_element.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Element.setProperty(function tabIndex() {
*
* @author Jelle De Loecker <jelle@develry.be>
* @since 1.3.0
* @version 1.3.1
* @version 2.3.16
*
* @type {String}
*/
Expand All @@ -208,8 +208,14 @@ Element.setProperty(function value() {
return this[VALUE];
}, function setValue(value) {

// Setting the value of a textarea breaks the bond between the innerHTML
if (this.tagName != 'TEXTAREA') {
if (this.tagName == 'TEXTAREA') {

if (value === null) {
value = '';
}

this.textContent = value;
} else {
if (HAS_VALUE[this.tagName]) {
return this.setAttribute('value', value);
}
Expand Down

0 comments on commit f65b489

Please sign in to comment.