TrustedTypePolicyFactory

The TrustedTypePolicyFactory interface of the Trusted Types API creates policies and allows the verification of Trusted Type objects against created policies.

MDN Reference

Properties

Link copied to clipboard

The defaultPolicy read-only property of the TrustedTypePolicyFactory interface returns the default TrustedTypePolicy or null if this is empty.

Link copied to clipboard

The emptyHTML read-only property of the TrustedTypePolicyFactory interface returns a TrustedHTML object containing an empty string.

Link copied to clipboard

The emptyScript read-only property of the TrustedTypePolicyFactory interface returns a TrustedScript object containing an empty string.

Functions

Link copied to clipboard
fun createPolicy(policyName: String, policyOptions: TrustedTypePolicyOptions = definedExternally): TrustedTypePolicy

The createPolicy() method of the TrustedTypePolicyFactory interface creates a TrustedTypePolicy object that implements the rules passed as policyOptions.

Link copied to clipboard
fun getAttributeType(tagName: String, attribute: String, elementNs: String? = definedExternally, attrNs: String? = definedExternally): String?

The getAttributeType() method of the TrustedTypePolicyFactory interface allows web developers to check if a Trusted Type is required for an element, and if so which Trusted Type is used.

Link copied to clipboard
fun getPropertyType(tagName: String, property: String, elementNs: String? = definedExternally): String?

The getPropertyType() method of the TrustedTypePolicyFactory interface allows web developers to check if a Trusted Type is required for an element's property.

Link copied to clipboard
fun isHTML(value: JsAny?): Boolean

The isHTML() method of the TrustedTypePolicyFactory interface returns true if it is passed a valid TrustedHTML object.

Link copied to clipboard
fun isScript(value: JsAny?): Boolean

The isScript() method of the TrustedTypePolicyFactory interface returns true if it is passed a valid TrustedScript object.

Link copied to clipboard
fun isScriptURL(value: JsAny?): Boolean

The isScriptURL() method of the TrustedTypePolicyFactory interface returns true if it is passed a valid TrustedScriptURL object.