Class @ember/string

Module: @ember/string
Since: v2.16.4

Show:

Module: @ember/string

Available since v2.16.4

returns
Handlebars.SafeString
A string that will not be HTML escaped by Handlebars.

Mark a string as safe for unescaped output with Ember templates. If you return HTML from a helper, use this function to ensure Ember's rendering layer does not escape the HTML.

1
2
3
import { htmlSafe } from '@ember/string';

htmlSafe('<div>someString</div>')
Module: @ember/string

Available since v2.16.4

returns
Boolean
`true` if the string was decorated with `htmlSafe`, `false` otherwise.

Detects if a string was decorated using htmlSafe.

1
2
3
4
5
6
7
import { htmlSafe, isHTMLSafe } from '@ember/string';

var plainString = 'plain string',
    safeString = htmlSafe('<div>someValue</div>');

isHTMLSafe(plainString); // false
isHTMLSafe(safeString);  // true