trustedTypes methods

The window.trustedTypes object is an instance of a TrustedTypePolicyFactory object.

Method Name Returns Description
createPolicy(policyName, policyOptions) TrustedTypePolicy Creates a trusted type policy object with the given policyName. The policyOptions is an object you define with any of the following functions:

createHTML(input[,args]) - transforms the input string and returns a TrustedHTML object.
createScript(input[,args]) - transforms the input string and returns a TrustedScript object.
createScriptURL(input[,args]) - transforms the input string and returns a TrustedScriptURL object.

The createPolicy method may throw a TypeError if the policyName is restricted by CSP trusted-types directive.
isHTML(value) boolean Returns true if the value is a TrustedHTML object.
isScript(value) boolean Returns true if the value is a TrustedScript object.
isScriptURL(value) boolean Returns true if the value is a TrustedScriptURL object.