diff --git a/src/HTMLElement.php b/src/HTMLElement.php
index 86423f74..f2803e6e 100644
--- a/src/HTMLElement.php
+++ b/src/HTMLElement.php
@@ -791,6 +791,9 @@ protected function __prop_get_value():string {
return $this->options[$this->selectedIndex]->value;
}
+ elseif($this->elementType === ElementType::HTMLTextAreaElement) {
+ return $this->nodeValue;
+ }
return $this->textContent;
}
@@ -832,6 +835,9 @@ protected function __prop_set_value(string $value):void {
}
}
}
+ elseif($this->elementType === ElementType::HTMLTextAreaElement) {
+ $this->nodeValue = $value;
+ }
else {
$this->setAttribute("value", $value);
}
diff --git a/test/phpunit/HTMLElement/HTMLElementTest.php b/test/phpunit/HTMLElement/HTMLElementTest.php
index e9a4af1b..e597cbd9 100644
--- a/test/phpunit/HTMLElement/HTMLElementTest.php
+++ b/test/phpunit/HTMLElement/HTMLElementTest.php
@@ -332,4 +332,15 @@ public function testToString():void {
$sut->textContent = uniqid();
self::assertSame("", (string)$sut);
}
+
+ public function testValue_textarea():void {
+ $document = new HTMLDocument();
+ $sut = $document->createElement("textarea");
+ $sut->value = "example123";
+ self::assertSame("", $sut->outerHTML);
+ self::assertFalse($sut->hasAttribute("value"));
+
+ $sut->innerHTML = "changed value";
+ self::assertSame("changed value", $sut->value);
+ }
}
diff --git a/test/phpunit/HTMLElement/HTMLTextAreaElementTest.php b/test/phpunit/HTMLElement/HTMLTextAreaElementTest.php
index e42c7981..c076affa 100644
--- a/test/phpunit/HTMLElement/HTMLTextAreaElementTest.php
+++ b/test/phpunit/HTMLElement/HTMLTextAreaElementTest.php
@@ -16,12 +16,6 @@ public function testCols():void {
self::assertPropertyAttributeCorrelateNumber($sut, "int:20", "cols");
}
- public function testDefaultValue():void {
- $document = new HTMLDocument();
- $sut = $document->createElement("textarea");
- self::assertPropertyAttributeCorrelate($sut, "value", "defaultValue");
- }
-
public function testMaxLength():void {
$document = new HTMLDocument();
$sut = $document->createElement("textarea");