goog.html.SafeHtmlFormatter
Module ID |
---|
Formatter producing SafeHtml from a plain text format and HTML fragments. Example usage: var formatter = new SafeHtmlFormatter(); var safeHtml = formatter.format( formatter.startTag('b') + 'User input:' + formatter.endTag('b') + ' ' + formatter.text(userInput)); The most common usage is with goog.getMsg: var MSG_USER_INPUT = goog.getMsg( '{$startLink}Learn more{$endLink} about {$userInput}', { 'startLink': formatter.startTag('a', {'href': url}), 'endLink': formatter.endTag('a'), 'userInput': formatter.text(userInput) }); var safeHtml = formatter.format(MSG_USER_INPUT); The formatting string should be constant with all variables processed by formatter.text().
new SafeHtmlFormatter()
Parameters | None. |
---|