Firefox Tomorrow

web api instance property

TrustedTypePolicy: name property

View on MDN ↗

Available in workers

The name read-only property of the TrustedTypePolicy interface returns the name of the policy.

Value

A string containing the name of the policy.

Examples

In the below example a policy called myEscapePolicy is created using createPolicy() and is represented by the object escapeHTMLPolicy. Calling name on this object returns the string “myEscapePolicy”.

const escapeHTMLPolicy = trustedTypes.createPolicy("myEscapePolicy", {
  createHTML: (string) => string.replace(/</g, "&lt;"),
});

console.log(escapeHTMLPolicy.name); /* "myEscapePolicy" */

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.