Skip to content

Commit

Permalink
Call hook when creating text (#436)
Browse files Browse the repository at this point in the history
* Call hook when creating text

* CHangeset
  • Loading branch information
jakearchibald authored Sep 3, 2024
1 parent c9df29d commit 5979797
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/mean-snakes-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@remote-dom/polyfill': patch
---

Ensure the `createText` hook is called when creating a new text node
4 changes: 3 additions & 1 deletion packages/polyfill/source/Document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export class Document extends ParentNode {
}

createTextNode(data: any) {
return createNode(new Text(data), this);
const text = createNode(new Text(data), this);
this[HOOKS].createText?.(text as any, String(data));
return text;
}

createComment(data: any) {
Expand Down

0 comments on commit 5979797

Please sign in to comment.