HTML construction helper functions.
Example
var Html, output;
Html = mw.html;
output = Html.element( 'div', {}, new Html.Raw(
Html.element( 'img', { src: '<' } )
) );
mw.log( output ); // <div><img src="<"/></div>
Classes
- Raw
- Wrapper object for raw HTML.
Methods
element(name, [attrs], [contents]) → {string}static
#
Create an HTML element string, with safe escaping.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string | The tag name. |
||
attrs |
Object |
optional |
An object with members mapping element names to values |
|
contents |
string
|
mw.html.Raw
|
null
|
optional |
null | The contents of the element.
|
- Source:
Returns:
HTML
- Type
- string
Create an HTML element string, with safe escaping.
escape(s) → {string}static
#
Escape a string for HTML.