Skip to content

Commit 0b2abe1

Browse files
committed
Add dedicated docs for innerHTML and textContent
1 parent 2c5de7f commit 0b2abe1

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

src/middleware/legacy-routes-redirect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const LEGACY_ROUTES = {
5959
"/references/api-reference/secondary-primitives/createSelector": "/reference/secondary-primitives/create-selector",
6060
"/references/api-reference/special-jsx-attributes/attr_": "/reference/jsx-attributes/attr",
6161
"/references/api-reference/special-jsx-attributes/classList": "/reference/jsx-attributes/classlist",
62-
"/references/api-reference/special-jsx-attributes/innerHTML-or-textContent": "/reference/jsx-attributes/innerhtml-or-textcontent",
62+
"/references/api-reference/special-jsx-attributes/innerHTML-or-textContent": "/reference/jsx-attributes/innerhtml",
6363
"/references/api-reference/special-jsx-attributes/on_": "/reference/jsx-attributes/on_",
6464
"/references/api-reference/special-jsx-attributes/on_-and-oncapture_": "/reference/jsx-attributes/on",
6565

src/routes/reference/jsx-attributes/data.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"attr.mdx",
55
"classlist.mdx",
66
"bool.mdx",
7-
"innerhtml-or-textcontent.mdx",
7+
"innerhtml.mdx",
8+
"textcontent.mdx",
89
"on_.mdx",
910
"on.mdx",
1011
"once.mdx",

src/routes/reference/jsx-attributes/innerhtml-or-textcontent.mdx

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: innerHTML
3+
---
4+
5+
The `innerHTML` attribute is equivalent to the [`innerHTML` DOM property](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML).
6+
This attribute replaces all existing nodes of the element with new nodes generated by parsing the provided string as HTML.
7+
8+
Note that using `innerHTML` with unsanitized user-supplied data can introduce security vulnerabilities.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: textContent
3+
---
4+
5+
The `textContent` attribute is equivalent to the [`textContent` DOM property](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent).
6+
This attribute replaces all existing child nodes of the element with a single text node containing the provided string.
7+
8+
Using `textContent` can improve performance when the element's children are known to be exclusively text, as it bypasses the generic diffing process.

0 commit comments

Comments
 (0)