Skip to content

Commit 36c9856

Browse files
committed
Addressed feedbacks
1 parent 32c72ce commit 36c9856

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/js/_enqueues/wp/sanitize.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,20 @@
2323
* @return {string} Stripped text.
2424
*/
2525
stripTags: function( text ) {
26-
2726
const domParser = new DOMParser();
2827
const htmlDocument = domParser.parseFromString(
2928
text,
3029
'text/html'
3130
);
3231

3332
/*
34-
* This looks funny and appears to be a no-op, but it
35-
* enforces the escaping. How? when _read_ the `innerText`
36-
* property decodes character references, returning a raw
37-
* string. When _written_, however, it re-encodes to ensure
38-
* that the rendered text replicates what its given.
33+
* The following self-assignment appears to be a no-op, but it isn't.
34+
* It enforces the escaping. Reading the `innerText` property decodes
35+
* character references, returning a raw string. When written, however,
36+
* the text is re-escaped to ensure that the rendered text replicates
37+
* what it's given.
3938
*
40-
* See: https://github.com/WordPress/wordpress-develop/pull/10536#discussion_r2550615378
39+
* See <https://github.com/WordPress/wordpress-develop/pull/10536#discussion_r2550615378>.
4140
*/
4241
htmlDocument.body.innerText = htmlDocument.body.innerText;
4342

0 commit comments

Comments
 (0)