dfd081f25f87c25d88cea002ff211101a02c2f2f
3 * Collection of methods to generate HTML content
5 * Copyright © 2009 Aryeh Gregor
6 * http://www.mediawiki.org/
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * http://www.gnu.org/copyleft/gpl.html
27 * This class is a collection of static functions that serve two purposes:
29 * 1) Implement any algorithms specified by HTML5, or other HTML
30 * specifications, in a convenient and self-contained way.
32 * 2) Allow HTML elements to be conveniently and safely generated, like the
33 * current Xml class but a) less confused (Xml supports HTML-specific things,
34 * but only sometimes!) and b) not necessarily confined to XML-compatible
37 * There are two important configuration options this class uses:
39 * $wgHtml5: If this is set to false, then all output should be valid XHTML 1.0
41 * $wgWellFormedXml: If this is set to true, then all output should be
42 * well-formed XML (quotes on attributes, self-closing tags, etc.).
44 * This class is meant to be confined to utility functions that are called from
45 * trusted code paths. It does not do enforcement of policy like not allowing
51 # List of void elements from HTML5, section 8.1.2 as of 2011-08-12
52 private static $voidElements = array(
71 # Boolean attributes, which may have the value omitted entirely. Manually
72 # collected from the HTML5 spec as of 2011-08-12.
73 private static $boolAttribs = array(
104 private static $HTMLFiveOnlyAttribs = array(
118 * Returns an HTML element in a string. The major advantage here over
119 * manually typing out the HTML is that it will escape all attribute
120 * values. If you're hardcoding all the attributes, or there are none, you
121 * should probably just type out the html element yourself.
123 * This is quite similar to Xml::tags(), but it implements some useful
124 * HTML-specific logic. For instance, there is no $allowShortTag
125 * parameter: the closing tag is magically omitted if $element has an empty
126 * content model. If $wgWellFormedXml is false, then a few bytes will be
127 * shaved off the HTML output as well.
129 * @param $element string The element's name, e.g., 'a'
130 * @param $attribs array Associative array of attributes, e.g., array(
131 * 'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
132 * further documentation.
133 * @param $contents string The raw HTML contents of the element: *not*
135 * @return string Raw HTML
137 public static function rawElement( $element, $attribs = array(), $contents = '' ) {
138 global $wgWellFormedXml;
139 $start = self
::openElement( $element, $attribs );
140 if ( in_array( $element, self
::$voidElements ) ) {
141 if ( $wgWellFormedXml ) {
143 return substr( $start, 0, -1 ) . ' />';
147 return "$start$contents" . self
::closeElement( $element );
152 * Identical to rawElement(), but HTML-escapes $contents (like
155 * @param $element string
156 * @param $attribs array
157 * @param $contents string
161 public static function element( $element, $attribs = array(), $contents = '' ) {
162 return self
::rawElement( $element, $attribs, strtr( $contents, array(
163 # There's no point in escaping quotes, >, etc. in the contents of
171 * Identical to rawElement(), but has no third parameter and omits the end
172 * tag (and the self-closing '/' in XML mode for empty elements).
174 * @param $element string
175 * @param $attribs array
179 public static function openElement( $element, $attribs = array() ) {
180 global $wgHtml5, $wgWellFormedXml;
181 $attribs = (array)$attribs;
182 # This is not required in HTML5, but let's do it anyway, for
183 # consistency and better compression.
184 $element = strtolower( $element );
186 # In text/html, initial <html> and <head> tags can be omitted under
187 # pretty much any sane circumstances, if they have no attributes. See:
188 # <http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#optional-tags>
189 if ( !$wgWellFormedXml && !$attribs
190 && in_array( $element, array( 'html', 'head' ) ) ) {
194 # Remove invalid input types
195 if ( $element == 'input' ) {
209 # Allow more input types in HTML5 mode
211 $validTypes = array_merge( $validTypes, array(
227 if ( isset( $attribs['type'] )
228 && !in_array( $attribs['type'], $validTypes ) ) {
229 unset( $attribs['type'] );
233 if ( !$wgHtml5 && $element == 'textarea' && isset( $attribs['maxlength'] ) ) {
234 unset( $attribs['maxlength'] );
237 return "<$element" . self
::expandAttributes(
238 self
::dropDefaults( $element, $attribs ) ) . '>';
242 * Returns "</$element>", except if $wgWellFormedXml is off, in which case
243 * it returns the empty string when that's guaranteed to be safe.
246 * @param $element string Name of the element, e.g., 'a'
247 * @return string A closing tag, if required
249 public static function closeElement( $element ) {
250 global $wgWellFormedXml;
252 $element = strtolower( $element );
255 # http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#optional-tags
256 if ( !$wgWellFormedXml && in_array( $element, array(
269 return "</$element>";
273 * Given an element name and an associative array of element attributes,
274 * return an array that is functionally identical to the input array, but
275 * possibly smaller. In particular, attributes might be stripped if they
276 * are given their default values.
278 * This method is not guaranteed to remove all redundant attributes, only
279 * some common ones and some others selected arbitrarily at random. It
280 * only guarantees that the output array should be functionally identical
281 * to the input array (currently per the HTML 5 draft as of 2009-09-06).
283 * @param $element string Name of the element, e.g., 'a'
284 * @param $attribs array Associative array of attributes, e.g., array(
285 * 'href' => 'http://www.mediawiki.org/' ). See expandAttributes() for
286 * further documentation.
287 * @return array An array of attributes functionally identical to $attribs
289 private static function dropDefaults( $element, $attribs ) {
290 # Don't bother doing anything if we aren't outputting HTML5; it's too
291 # much of a pain to maintain two sets of defaults.
297 # Whenever altering this array, please provide a covering test case
298 # in HtmlTest::provideElementsWithAttributesHavingDefaultValues
299 static $attribDefaults = array(
300 'area' => array( 'shape' => 'rect' ),
302 'formaction' => 'GET',
303 'formenctype' => 'application/x-www-form-urlencoded',
310 'command' => array( 'type' => 'command' ),
313 'autocomplete' => 'on',
314 'enctype' => 'application/x-www-form-urlencoded',
317 'formaction' => 'GET',
320 'keygen' => array( 'keytype' => 'rsa' ),
321 'link' => array( 'media' => 'all' ),
322 'menu' => array( 'type' => 'list' ),
323 # Note: the use of text/javascript here instead of other JavaScript
324 # MIME types follows the HTML5 spec.
325 'script' => array( 'type' => 'text/javascript' ),
328 'type' => 'text/css',
330 'textarea' => array( 'wrap' => 'soft' ),
333 $element = strtolower( $element );
335 foreach ( $attribs as $attrib => $value ) {
336 $lcattrib = strtolower( $attrib );
337 if( is_array( $value ) ) {
338 $value = implode( ' ', $value );
340 $value = strval( $value );
343 # Simple checks using $attribDefaults
344 if ( isset( $attribDefaults[$element][$lcattrib] ) &&
345 $attribDefaults[$element][$lcattrib] == $value ) {
346 unset( $attribs[$attrib] );
349 if ( $lcattrib == 'class' && $value == '' ) {
350 unset( $attribs[$attrib] );
355 if ( $element === 'link' && isset( $attribs['type'] )
356 && strval( $attribs['type'] ) == 'text/css' ) {
357 unset( $attribs['type'] );
359 if ( $element === 'input' ) {
360 $type = isset( $attribs['type'] ) ?
$attribs['type'] : null;
361 $value = isset( $attribs['value'] ) ?
$attribs['value'] : null;
362 if ( $type === 'checkbox' ||
$type === 'radio' ) {
363 // The default value for checkboxes and radio buttons is 'on'
364 // not ''. By stripping value="" we break radio boxes that
365 // actually wants empty values.
366 if ( $value === 'on' ) {
367 unset( $attribs['value'] );
369 } elseif ( $type === 'submit' ) {
370 // The default value for submit appears to be "Submit" but
371 // let's not bother stripping out localized text that matches
374 // The default value for nearly every other field type is ''
375 // The 'range' and 'color' types use different defaults but
376 // stripping a value="" does not hurt them.
377 if ( $value === '' ) {
378 unset( $attribs['value'] );
382 if ( $element === 'select' && isset( $attribs['size'] ) ) {
383 if ( in_array( 'multiple', $attribs )
384 ||
( isset( $attribs['multiple'] ) && $attribs['multiple'] !== false )
387 if ( strval( $attribs['size'] ) == '4' ) {
388 unset( $attribs['size'] );
392 if ( strval( $attribs['size'] ) == '1' ) {
393 unset( $attribs['size'] );
402 * Given an associative array of element attributes, generate a string
403 * to stick after the element name in HTML output. Like array( 'href' =>
404 * 'http://www.mediawiki.org/' ) becomes something like
405 * ' href="http://www.mediawiki.org"'. Again, this is like
406 * Xml::expandAttributes(), but it implements some HTML-specific logic.
407 * For instance, it will omit quotation marks if $wgWellFormedXml is false,
408 * and will treat boolean attributes specially.
410 * Attributes that should contain space-separated lists (such as 'class') array
411 * values are allowed as well, which will automagically be normalized
412 * and converted to a space-separated string. In addition to a numerical
413 * array, the attribute value may also be an associative array. See the
414 * example below for how that works.
416 * @par Numerical array
418 * Html::element( 'em', array(
419 * 'class' => array( 'foo', 'bar' )
421 * // gives '<em class="foo bar"></em>'
424 * @par Associative array
426 * Html::element( 'em', array(
427 * 'class' => array( 'foo', 'bar', 'foo' => false, 'quux' => true )
429 * // gives '<em class="bar quux"></em>'
432 * @param $attribs array Associative array of attributes, e.g., array(
433 * 'href' => 'http://www.mediawiki.org/' ). Values will be HTML-escaped.
434 * A value of false means to omit the attribute. For boolean attributes,
435 * you can omit the key, e.g., array( 'checked' ) instead of
436 * array( 'checked' => 'checked' ) or such.
437 * @return string HTML fragment that goes between element name and '>'
438 * (starting with a space if at least one attribute is output)
440 public static function expandAttributes( $attribs ) {
441 global $wgHtml5, $wgWellFormedXml;
444 $attribs = (array)$attribs;
445 foreach ( $attribs as $key => $value ) {
446 if ( $value === false ||
is_null( $value ) ) {
450 # For boolean attributes, support array( 'foo' ) instead of
451 # requiring array( 'foo' => 'meaningless' ).
453 && in_array( strtolower( $value ), self
::$boolAttribs ) ) {
457 # Not technically required in HTML5, but required in XHTML 1.0,
458 # and we'd like consistency and better compression anyway.
459 $key = strtolower( $key );
461 # Here we're blacklisting some HTML5-only attributes...
462 if ( !$wgHtml5 && in_array( $key, self
::$HTMLFiveOnlyAttribs )
467 # Bug 23769: Blacklist all form validation attributes for now. Current
468 # (June 2010) WebKit has no UI, so the form just refuses to submit
469 # without telling the user why, which is much worse than failing
470 # server-side validation. Opera is the only other implementation at
471 # this time, and has ugly UI, so just kill the feature entirely until
472 # we have at least one good implementation.
473 if ( in_array( $key, array( 'max', 'min', 'pattern', 'required', 'step' ) ) ) {
477 // http://www.w3.org/TR/html401/index/attributes.html ("space-separated")
478 // http://www.w3.org/TR/html5/index.html#attributes-1 ("space-separated")
479 $spaceSeparatedListAttributes = array(
480 'class', // html4, html5
481 'accesskey', // as of html5, multiple space-separated values allowed
482 // html4-spec doesn't document rel= as space-separated
483 // but has been used like that and is now documented as such
484 // in the html5-spec.
488 # Specific features for attributes that allow a list of space-separated values
489 if ( in_array( $key, $spaceSeparatedListAttributes ) ) {
490 // Apply some normalization and remove duplicates
492 // Convert into correct array. Array can contain space-seperated
493 // values. Implode/explode to get those into the main array as well.
494 if ( is_array( $value ) ) {
495 // If input wasn't an array, we can skip this step
498 foreach ( $value as $k => $v ) {
499 if ( is_string( $v ) ) {
500 // String values should be normal `array( 'foo' )`
502 if ( !isset( $value[$v] ) ) {
503 // As a special case don't set 'foo' if a
504 // separate 'foo' => true/false exists in the array
505 // keys should be authoritive
509 // If the value is truthy but not a string this is likely
510 // an array( 'foo' => true ), falsy values don't add strings
514 $value = implode( ' ', $newValue );
516 $value = explode( ' ', $value );
518 // Normalize spacing by fixing up cases where people used
519 // more than 1 space and/or a trailing/leading space
520 $value = array_diff( $value, array( '', ' ' ) );
522 // Remove duplicates and create the string
523 $value = implode( ' ', array_unique( $value ) );
526 # See the "Attributes" section in the HTML syntax part of HTML5,
527 # 9.1.2.3 as of 2009-08-10. Most attributes can have quotation
528 # marks omitted, but not all. (Although a literal " is not
529 # permitted, we don't check for that, since it will be escaped
532 # See also research done on further characters that need to be
533 # escaped: http://code.google.com/p/html5lib/issues/detail?id=93
534 $badChars = "\\x00- '=<>`/\x{00a0}\x{1680}\x{180e}\x{180F}\x{2000}\x{2001}"
535 . "\x{2002}\x{2003}\x{2004}\x{2005}\x{2006}\x{2007}\x{2008}\x{2009}"
536 . "\x{200A}\x{2028}\x{2029}\x{202F}\x{205F}\x{3000}";
537 if ( $wgWellFormedXml ||
$value === ''
538 ||
preg_match( "![$badChars]!u", $value ) ) {
544 if ( in_array( $key, self
::$boolAttribs ) ) {
545 # In XHTML 1.0 Transitional, the value needs to be equal to the
546 # key. In HTML5, we can leave the value empty instead. If we
547 # don't need well-formed XML, we can omit the = entirely.
548 if ( !$wgWellFormedXml ) {
550 } elseif ( $wgHtml5 ) {
551 $ret .= " $key=\"\"";
553 $ret .= " $key=\"$key\"";
556 # Apparently we need to entity-encode \n, \r, \t, although the
557 # spec doesn't mention that. Since we're doing strtr() anyway,
558 # and we don't need <> escaped here, we may as well not call
559 # htmlspecialchars().
560 # @todo FIXME: Verify that we actually need to
561 # escape \n\r\t here, and explain why, exactly.
563 # We could call Sanitizer::encodeAttribute() for this, but we
564 # don't because we're stubborn and like our marginal savings on
565 # byte size from not having to encode unnecessary quotes.
573 if ( $wgWellFormedXml ) {
574 # This is allowed per spec: <http://www.w3.org/TR/xml/#NT-AttValue>
575 # But reportedly it breaks some XML tools?
576 # @todo FIXME: Is this really true?
580 $ret .= " $key=$quote" . strtr( $value, $map ) . $quote;
587 * Output a "<script>" tag with the given contents.
589 * @todo do some useful escaping as well, like if $contents contains
590 * literal "</script>" or (for XML) literal "]]>".
592 * @param $contents string JavaScript
593 * @return string Raw HTML
595 public static function inlineScript( $contents ) {
596 global $wgHtml5, $wgJsMimeType, $wgWellFormedXml;
601 $attrs['type'] = $wgJsMimeType;
604 if ( $wgWellFormedXml && preg_match( '/[<&]/', $contents ) ) {
605 $contents = "/*<![CDATA[*/$contents/*]]>*/";
608 return self
::rawElement( 'script', $attrs, $contents );
612 * Output a "<script>" tag linking to the given URL, e.g.,
613 * "<script src=foo.js></script>".
616 * @return string Raw HTML
618 public static function linkedScript( $url ) {
619 global $wgHtml5, $wgJsMimeType;
621 $attrs = array( 'src' => $url );
624 $attrs['type'] = $wgJsMimeType;
627 return self
::element( 'script', $attrs );
631 * Output a "<style>" tag with the given contents for the given media type
632 * (if any). TODO: do some useful escaping as well, like if $contents
633 * contains literal "</style>" (admittedly unlikely).
635 * @param $contents string CSS
636 * @param $media mixed A media type string, like 'screen'
637 * @return string Raw HTML
639 public static function inlineStyle( $contents, $media = 'all' ) {
640 global $wgWellFormedXml;
642 if ( $wgWellFormedXml && preg_match( '/[<&]/', $contents ) ) {
643 $contents = "/*<![CDATA[*/$contents/*]]>*/";
646 return self
::rawElement( 'style', array(
647 'type' => 'text/css',
653 * Output a "<link rel=stylesheet>" linking to the given URL for the given
654 * media type (if any).
657 * @param $media mixed A media type string, like 'screen'
658 * @return string Raw HTML
660 public static function linkedStyle( $url, $media = 'all' ) {
661 return self
::element( 'link', array(
662 'rel' => 'stylesheet',
664 'type' => 'text/css',
670 * Convenience function to produce an "<input>" element. This supports the
671 * new HTML5 input types and attributes, and will silently strip them if
674 * @param $name string name attribute
675 * @param $value mixed value attribute
676 * @param $type string type attribute
677 * @param $attribs array Associative array of miscellaneous extra
678 * attributes, passed to Html::element()
679 * @return string Raw HTML
681 public static function input( $name, $value = '', $type = 'text', $attribs = array() ) {
682 $attribs['type'] = $type;
683 $attribs['value'] = $value;
684 $attribs['name'] = $name;
686 return self
::element( 'input', $attribs );
690 * Convenience function to produce an input element with type=hidden
692 * @param $name string name attribute
693 * @param $value string value attribute
694 * @param $attribs array Associative array of miscellaneous extra
695 * attributes, passed to Html::element()
696 * @return string Raw HTML
698 public static function hidden( $name, $value, $attribs = array() ) {
699 return self
::input( $name, $value, 'hidden', $attribs );
703 * Convenience function to produce an "<input>" element.
705 * This supports leaving out the cols= and rows= which Xml requires and are
706 * required by HTML4/XHTML but not required by HTML5 and will silently set
707 * cols="" and rows="" if $wgHtml5 is false and cols and rows are omitted
708 * (HTML4 validates present but empty cols="" and rows="" as valid).
710 * @param $name string name attribute
711 * @param $value string value attribute
712 * @param $attribs array Associative array of miscellaneous extra
713 * attributes, passed to Html::element()
714 * @return string Raw HTML
716 public static function textarea( $name, $value = '', $attribs = array() ) {
719 $attribs['name'] = $name;
722 if ( !isset( $attribs['cols'] ) ) {
723 $attribs['cols'] = "";
726 if ( !isset( $attribs['rows'] ) ) {
727 $attribs['rows'] = "";
731 if (substr($value, 0, 1) == "\n") {
732 // Workaround for bug 12130: browsers eat the initial newline
733 // assuming that it's just for show, but they do keep the later
734 // newlines, which we may want to preserve during editing.
735 // Prepending a single newline
736 $spacedValue = "\n" . $value;
738 $spacedValue = $value;
740 return self
::element( 'textarea', $attribs, $spacedValue );
743 * Build a drop-down box for selecting a namespace
745 * @param $params array:
746 * - selected: [optional] Id of namespace which should be pre-selected
747 * - all: [optional] Value of item for "all namespaces". If null or unset, no "<option>" is generated to select all namespaces
748 * - label: text for label to add before the field
749 * - exclude: [optional] Array of namespace ids to exclude
750 * - disable: [optional] Array of namespace ids for which the option should be disabled in the selector
751 * @param $selectAttribs array HTML attributes for the generated select element.
752 * - id: [optional], default: 'namespace'
753 * - name: [optional], default: 'namespace'
754 * @return string HTML code to select a namespace.
756 public static function namespaceSelector( Array $params = array(), Array $selectAttribs = array() ) {
759 ksort( $selectAttribs );
761 // Is a namespace selected?
762 if ( isset( $params['selected'] ) ) {
763 // If string only contains digits, convert to clean int. Selected could also
764 // be "all" or "" etc. which needs to be left untouched.
765 // PHP is_numeric() has issues with large strings, PHP ctype_digit has other issues
766 // and returns false for already clean ints. Use regex instead..
767 if ( preg_match( '/^\d+$/', $params['selected'] ) ) {
768 $params['selected'] = intval( $params['selected'] );
770 // else: leaves it untouched for later processing
772 $params['selected'] = '';
775 if ( !isset( $params['exclude'] ) ||
!is_array( $params['exclude'] ) ) {
776 $params['exclude'] = array();
778 if ( !isset( $params['disable'] ) ||
!is_array( $params['disable'] ) ) {
779 $params['disable'] = array();
782 // Associative array between option-values and option-labels
785 if ( isset( $params['all'] ) ) {
786 // add an option that would let the user select all namespaces.
787 // Value is provided by user, the name shown is localized for the user.
788 $options[$params['all']] = wfMessage( 'namespacesall' )->text();
790 // Add all namespaces as options (in the content langauge)
791 $options +
= $wgContLang->getFormattedNamespaces();
793 // Convert $options to HTML and filter out namespaces below 0
794 $optionsHtml = array();
795 foreach ( $options as $nsId => $nsName ) {
796 if ( $nsId < NS_MAIN ||
in_array( $nsId, $params['exclude'] ) ) {
800 // For other namespaces use use the namespace prefix as label, but for
801 // main we don't use "" but the user message descripting it (e.g. "(Main)" or "(Article)")
802 $nsName = wfMessage( 'blanknamespace' )->text();
804 $optionsHtml[] = Html
::element(
806 'disabled' => in_array( $nsId, $params['disable'] ),
808 'selected' => $nsId === $params['selected'],
814 if ( isset( $params['label'] ) ) {
815 $ret .= Html
::element(
817 'for' => isset( $selectAttribs['id'] ) ?
$selectAttribs['id'] : null,
822 // Wrap options in a <select>
823 $ret .= Html
::openElement( 'select', $selectAttribs )
825 . implode( "\n", $optionsHtml )
827 . Html
::closeElement( 'select' );
833 * Constructs the opening html-tag with necessary doctypes depending on
836 * @param $attribs array Associative array of miscellaneous extra
837 * attributes, passed to Html::element() of html tag.
838 * @return string Raw HTML
840 public static function htmlHeader( $attribs = array() ) {
845 if ( self
::isXmlMimeType( $wgMimeType ) ) {
846 $ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n";
849 global $wgHtml5, $wgHtml5Version, $wgDocType, $wgDTD;
850 global $wgXhtmlNamespaces, $wgXhtmlDefaultNamespace;
853 $ret .= "<!DOCTYPE html>\n";
855 if ( $wgHtml5Version ) {
856 $attribs['version'] = $wgHtml5Version;
859 $ret .= "<!DOCTYPE html PUBLIC \"$wgDocType\" \"$wgDTD\">\n";
860 $attribs['xmlns'] = $wgXhtmlDefaultNamespace;
862 foreach ( $wgXhtmlNamespaces as $tag => $ns ) {
863 $attribs["xmlns:$tag"] = $ns;
867 $html = Html
::openElement( 'html', $attribs );
879 * Determines if the given mime type is xml.
881 * @param $mimetype string MimeType
884 public static function isXmlMimeType( $mimetype ) {
885 switch ( $mimetype ) {
887 case 'application/xhtml+xml':
888 case 'application/xml':
896 * Get HTML for an info box with an icon.
898 * @param $text String: wikitext, get this with wfMessage()->plain()
899 * @param $icon String: icon name, file in skins/common/images
900 * @param $alt String: alternate text for the icon
901 * @param $class String: additional class name to add to the wrapper div
902 * @param $useStylePath
906 static function infoBox( $text, $icon, $alt, $class = false, $useStylePath = true ) {
909 if ( $useStylePath ) {
910 $icon = $wgStylePath.'/common/images/'.$icon;
913 $s = Html
::openElement( 'div', array( 'class' => "mw-infobox $class") );
915 $s .= Html
::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ).
916 Html
::element( 'img',
922 Html
::closeElement( 'div' );
924 $s .= Html
::openElement( 'div', array( 'class' => 'mw-infobox-right' ) ).
926 Html
::closeElement( 'div' );
927 $s .= Html
::element( 'div', array( 'style' => 'clear: left;' ), ' ' );
929 $s .= Html
::closeElement( 'div' );
931 $s .= Html
::element( 'div', array( 'style' => 'clear: left;' ), ' ' );