TrustedTypePolicy Class

https://w3c.github.io/trusted-types/dist/spec/#trusted-type-policy: creates trusted types by applying the rules of the callbacks given to TrustedTypePolicyFactory.CreatePolicy.

public sealed class TrustedTypePolicy

Properties

NameDescription
NameGets the name of the policy.

Gets the name of the policy.

public string Name { get; }

Methods

NameDescription
CreateHtml(string, object?[])https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicy-createhtml
CreateParserOptions(SetHtmlUnsafeOptions?, object?[])https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicy-createparseroptions: the TrustedHtmlParserOptions created from the options returned by the createParserOptions callback.
CreateScript(string, object?[])https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicy-createscript
CreateScriptUrl(string, object?[])https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicy-createscripturl

CreateHtml(string, object?[])

TrustedTypes.cs

https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicy-createhtml

public TrustedHtml CreateHtml(string input, params object?[] arguments)

Parameters

input string
arguments object?[]

Returns

TrustedHtml

Exceptions

TypeErrorException
The policy has no createHTML callback.

See also

CreateParserOptions(SetHtmlUnsafeOptions?, object?[])

TrustedTypes.cs

https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicy-createparseroptions: the TrustedHtmlParserOptions created from the options returned by the createParserOptions callback.

public TrustedHtmlParserOptions CreateParserOptions(SetHtmlUnsafeOptions? options = null, params object?[] arguments)

Parameters

options SetHtmlUnsafeOptions?
arguments object?[]

Returns

TrustedHtmlParserOptions

Exceptions

TypeErrorException
The policy has no createParserOptions callback, or the callback returned null.

See also

CreateScript(string, object?[])

TrustedTypes.cs

https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicy-createscript

public TrustedScript CreateScript(string input, params object?[] arguments)

Parameters

input string
arguments object?[]

Returns

TrustedScript

Exceptions

TypeErrorException
The policy has no createScript callback.

See also

CreateScriptUrl(string, object?[])

TrustedTypes.cs

https://w3c.github.io/trusted-types/dist/spec/#dom-trustedtypepolicy-createscripturl

public TrustedScriptUrl CreateScriptUrl(string input, params object?[] arguments)

Parameters

input string
arguments object?[]

Returns

TrustedScriptUrl

Exceptions

TypeErrorException
The policy has no createScriptURL callback.

See also