Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix sanitizer usage in setHTMLUnsafe examples#43307

Open
dibery wants to merge 1 commit intomdn:mainfrom
dibery:patch-1
Open

Fix sanitizer usage in setHTMLUnsafe examples#43307
dibery wants to merge 1 commit intomdn:mainfrom
dibery:patch-1

Conversation

@dibery
Copy link

@dibery dibery commented Mar 2, 2026

Description

Fix sanitizer usage in setHTMLUnsafe examples. Current example doesn't work.

Motivation

Fix usage example so future readers won't have to spend time figuring out why the example code doesn't work.

Additional details

There are problems in these examples in the following sections:
https://developer.mozilla.org/en-US/docs/Web/API/HTML_Sanitizer_API#sanitization_methods
https://developer.mozilla.org/en-US/docs/Web/API/HTML_Sanitizer_API#using_an_allow_sanitizer_configuration

Related issues and pull requests

No.

@dibery dibery requested a review from a team as a code owner March 2, 2026 07:24
@dibery dibery requested review from chrisdavidmills and removed request for a team March 2, 2026 07:24
@github-actions github-actions bot added Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed labels Mar 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Preview URLs (1 page)

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dibery I've tested the code examples in question, and they seem to work for me. They are only snippets, and to get the example to work, you'd also have to create the someElement and untrustedString references.

But the bit you've changed doesn't look wrong in the first place.

What did you find that didn't work about the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants