declare global { namespace mw { /** * HTML construction helper functions. * * @example * ```js * var Html, output; * * Html = mw.html; * output = Html.element( 'div', {}, new Html.Raw( * Html.element( 'img', { src: '<' } ) * ) ); * mw.log( output ); //
* ``` * @see https://doc.wikimedia.org/mediawiki-core/master/js/mw.html.html */ namespace html { /** * Create an HTML element string, with safe escaping. * * @param name The tag name. * @param attrs An object with members mapping element names to values * @param contents The contents of the element. * * - string: Text to be escaped. * - null: The element is treated as void with short closing form, e.g. `
`. * - this.Raw: The raw value is directly included. * @returns HTML * @see https://doc.wikimedia.org/mediawiki-core/master/js/mw.html.html#.element */ function element( name: string, attrs?: Record, contents?: string | Raw | null ): string; /** * Escape a string for HTML. * * Converts special characters to HTML entities. * * @example * ```js * mw.html.escape( '< > \' & "' ); * // Returns < > ' & " * ``` * @param s The string to escape * @returns HTML * @see https://doc.wikimedia.org/mediawiki-core/master/js/mw.html.html#.escape */ function escape(s: string): string; /** * Wrapper object for raw HTML. Can be used with {@link mw.html.element}. * * @example * ```js * const raw = new mw.html.Raw( 'Text' ); * mw.html.element( 'div', { class: 'html' }, raw ); * ``` * @see https://doc.wikimedia.org/mediawiki-core/master/js/mw.html.Raw.html */ class Raw { value: V; /** * @see https://doc.wikimedia.org/mediawiki-core/master/js/mw.html.Raw.html#Raw */ constructor(value: V); } } } } export {};