diff --git a/src/dom/node.ts b/src/dom/node.ts index 258378f..64b2456 100644 --- a/src/dom/node.ts +++ b/src/dom/node.ts @@ -631,10 +631,6 @@ export class Text extends CharacterData { _shallowClone(): Node { return new Text(this.textContent); } - - get textContent(): string { - return this.nodeValue; - } } export class Comment extends CharacterData { diff --git a/test/units/CharacterData.ts b/test/units/CharacterData.ts index bccb4ce..be30104 100644 --- a/test/units/CharacterData.ts +++ b/test/units/CharacterData.ts @@ -128,3 +128,14 @@ Deno.test("CharacterData.after/before/remove/replaceWith", () => { assertEquals(comment.previousSibling, null); assertEquals(comment.nextSibling, null); }); + +Deno.test("CharacterData.textContent", () => { + const doc = new DOMParser().parseFromString( + `foo`, + "text/html", + ); + const text = doc.body.childNodes[0]; + assertEquals(text.textContent, "foo"); + text.textContent = "bar"; + assertEquals(text.textContent, "bar"); +});