Page MenuHomeWickedGov Phorge

templateUtil.js
No OneTemporary

Size
643 B
Referenced Files
None
Subscribers
None

templateUtil.js

/**
* @module templateUtil
* @private
*/
/**
* @param {string} str
* @return {string} The string with any HTML entities escaped.
*/
export function escapeHTML( str ) {
return mw.html.escape( str );
}
const templates = {};
/**
* @param {string} html markup of the template
* @return {HTMLElement} a cloned root element of the template
*/
export function createNodeFromTemplate( html ) {
if ( !templates[ html ] ) {
// TODO: use <template> element when IE11 dies
const div = document.createElement( 'div' );
div.innerHTML = html;
templates[ html ] = div.firstElementChild;
}
return templates[ html ].cloneNode( true );
}

File Metadata

Mime Type
text/plain
Expires
Sat, May 16, 14:47 (23 h, 46 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
94/1d/0f85d7d89acf819ad4321004ae2a
Default Alt Text
templateUtil.js (643 B)

Event Timeline