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

This object can be used when the application requires an empty string to be inserted into an injection sink.


var emptyHTML = TrustedTypePolicyFactory.emptyHTML;


A TrustedHTML object.


In the below example an empty string is to be inserted into the element. Therefore there is no need to create a policy, and the emptyHTML property can be used to insert the empty element when a Trusted Types object is expected.

el.innerHTML = trustedTypes.emptyHTML;


Specification Status Comment
Trusted Types
The definition of 'TrustedTypePolicyFactory.emptyHTML' in that specification.
Editor's Draft Initial definition.

Browser compatibility

BCD tables only load in the browser