Implementation:SeleniumHQ Selenium Closure SafeHtml
| Knowledge Sources | |
|---|---|
| Domains | JavaScript_Atoms, Vendored_Library |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Vendored Google Closure Library module providing the SafeHtml type and its builders for safe HTML string handling, used by Selenium JavaScript atoms.
Description
goog.html.SafeHtml is a vendored copy of the Google Closure Library module. It provides a string-like object that carries the security type contract that its value, as a string, will not cause untrusted script execution when evaluated as HTML in a browser. Values are guaranteed safe for use in HTML contexts such as innerHTML assignment or HTML template interpolation. Instances must be created via factory methods (SafeHtml.create, SafeHtml.htmlEscape) and support Trusted Types Web API. Selenium uses this as part of its JavaScript atom infrastructure for browser automation commands.
Usage
This module is consumed internally by Selenium's JavaScript atoms build system. It is not imported directly by end users.
Code Reference
Source Location
- Repository: SeleniumHQ_Selenium
- File: third_party/closure/goog/html/safehtml.js
- Lines: 1-1002
Key Exports
goog.module('goog.html.SafeHtml');
// Final class: SafeHtml
// Factory methods: SafeHtml.create, SafeHtml.htmlEscape, SafeHtml.concat
// Security type for safe HTML strings preventing XSS.