Rendering
Methods for rendering content into the UI.
sanitizeData() |
---|
Sanitizes data from third-party sources before rendering it into the UI. |
Syntax
/** * @param {*} data The data to sanitize * @param {Boolean} allowHTML If true, allow HTML in the data properties [optional] * @return {*} The sanitized data */ portal.sanitizeData(data, allowHTML) |
Example
// Sanitize third-party data // Returns "<h1>Hello worlds</h1>" var sanitized = portal.sanitizeData({name: '<h1>Hello world</h1>'}); // Sanitize third-party data with HTML allowed // Returns "<h1>Hello world</h1>" var sanitized = portal.sanitizeData({name: '<h1>Hello world</h1>'}, true); |
stringToHTML() |
---|
Converts a template string into HTML DOM nodes. |
Syntax
/** * Convert a template string into HTML DOM nodes * @param {String} str The template string * @return {Node} The template HTML */ portal.stringToHTML(str) |
Example
// Convert a string to HTML // Returns <h1>Hello world</h1><p>How are you?</p> portal.stringToHTML('<h1>Hello world</h1><p>How are you?</p>'); |
Copyright © 2022. Cloud Software Group, Inc. All Rights Reserved.