-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
226 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @license | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
/** | ||
* @fileoverview This file exports a default instance of the CSS sanitizer, | ||
* similarly to how the default instance of the HTML sanitizer is exported. | ||
* | ||
* The reason why it's in a separate file is to ensure that html_sanitizer.ts | ||
* doesn't depend on html_sanitizer_builder.ts, which would cause | ||
* a circular dependency. | ||
*/ | ||
|
||
import {pure} from '../../internals/pure.js'; | ||
import {CssSanitizerBuilder} from './html_sanitizer_builder.js'; | ||
const defaultCssSanitizer = /* #__PURE__ */ pure(() => | ||
new CssSanitizerBuilder().build(), | ||
); | ||
/** Sanitizes untrusted CSS using the default sanitizer configuration. */ | ||
export function sanitizeHtmlWithCss(css: string): DocumentFragment { | ||
return defaultCssSanitizer.sanitizeToFragment(css); | ||
} |
Oops, something went wrong.