Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1427563
templateUtil.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
643 B
Referenced Files
None
Subscribers
None
templateUtil.js
View Options
/**
* @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
Details
Attached
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)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment