if ( !$attrs ) {
$attrs = array();
}
- if ( isset( $attrs['class'] ) ) {
- if ( is_array( $attrs['class'] ) ) {
- $attrs['class'][] = 'mw-ui-input';
+ if ( $wgUseMediaWikiUIEverywhere ) {
+ if ( isset( $attrs['class'] ) ) {
+ if ( is_array( $attrs['class'] ) ) {
+ $attrs['class'][] = 'mw-ui-input';
+ } else {
+ $attrs['class'] .= ' mw-ui-input';
+ }
} else {
- $attrs['class'] .= ' mw-ui-input';
+ $attrs['class'] = 'mw-ui-input';
}
- } else {
- $attrs['class'] = 'mw-ui-input';
- }
- if ( $wgUseMediaWikiUIEverywhere ) {
+
// Note that size can effect the desired width rendering of mw-ui-input elements
// so it is removed. Left intact when mediawiki ui not enabled.
unset( $attrs['size'] );
}
/**
- * Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enabled).
+ * Returns an HTML link element in a string styled as a button
+ * (when $wgUseMediaWikiUIEverywhere is enabled).
*
* @param string $contents The raw HTML contents of the element: *not*
* escaped!
}
/**
- * Returns an HTML link element in a string styled as a button (when $wgUseMediaWikiUIEverywhere is enabled).
+ * Returns an HTML link element in a string styled as a button
+ * (when $wgUseMediaWikiUIEverywhere is enabled).
*
* @param string $contents The raw HTML contents of the element: *not*
* escaped!
* @return string
*/
public static function openElement( $element, $attribs = array() ) {
- global $wgWellFormedXml;
$attribs = (array)$attribs;
// This is not required in HTML5, but let's do it anyway, for
// consistency and better compression.
$element = strtolower( $element );
- // In text/html, initial <html> and <head> tags can be omitted under
- // pretty much any sane circumstances, if they have no attributes. See:
- // <http://www.whatwg.org/html/syntax.html#optional-tags>
- if ( !$wgWellFormedXml && !$attribs && in_array( $element, array( 'html', 'head' ) ) ) {
- return '';
- }
-
// Remove invalid input types
if ( $element == 'input' ) {
$validTypes = array(