From ba0fc4fa20067528effd4802e53ceeb959640825 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 12 Jan 2012 13:42:29 +0100 Subject: Update to MediaWiki 1.18.1 --- resources/Resources.php | 2 +- resources/jquery/jquery.delayedBind.js | 5 ++++ resources/mediawiki/mediawiki.js | 49 +++++++++++++++++++++++----------- resources/mediawiki/mediawiki.util.js | 3 ++- 4 files changed, 41 insertions(+), 18 deletions(-) (limited to 'resources') diff --git a/resources/Resources.php b/resources/Resources.php index 7549b9c9..940d646d 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -668,7 +668,7 @@ return array( 'scripts' => 'common/mwsuggest.js', 'remoteBasePath' => $GLOBALS['wgStylePath'], 'localBasePath' => $GLOBALS['wgStyleDirectory'], - 'dependencies' => array( 'mediawiki.legacy.wikibits', 'jquery.client' ), + 'dependencies' => 'mediawiki.legacy.wikibits', 'messages' => array( 'search-mwsuggest-enabled', 'search-mwsuggest-disabled' ), ), 'mediawiki.legacy.preview' => array( diff --git a/resources/jquery/jquery.delayedBind.js b/resources/jquery/jquery.delayedBind.js index 6d972996..d84ee267 100644 --- a/resources/jquery/jquery.delayedBind.js +++ b/resources/jquery/jquery.delayedBind.js @@ -19,6 +19,11 @@ $.fn.extend( { * @param callback Function to call */ delayedBind: function( timeout, event, data, callback ) { + if ( arguments.length == 3 ) { + // Shift optional parameter down + callback = data; + data = undefined; + } var encEvent = encodeEvent( event ); return this.each( function() { var that = this; diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index a763ba93..aca59e4e 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -1133,9 +1133,17 @@ window.mediaWiki = new ( function( $ ) { * Returns
*/ this.element = function( name, attrs, contents ) { - var s = '<' + name; + var v, s = '<' + name; for ( var attrName in attrs ) { - s += ' ' + attrName + '="' + this.escape( attrs[attrName] ) + '"'; + v = attrs[attrName]; + // Convert name=true, to name=name + if ( v === true ) { + v = attrName; + // Skip name=false + } else if ( v === false ) { + continue; + } + s += ' ' + attrName + '="' + this.escape( '' + v ) + '"'; } if ( contents === undefined || contents === null ) { // Self close tag @@ -1144,20 +1152,29 @@ window.mediaWiki = new ( function( $ ) { } // Regular open tag s += '>'; - if ( typeof contents === 'string' ) { - // Escaped - s += this.escape( contents ); - } else if ( contents instanceof this.Raw ) { - // Raw HTML inclusion - s += contents.value; - } else if ( contents instanceof this.Cdata ) { - // CDATA - if ( /<\/[a-zA-z]/.test( contents.value ) ) { - throw new Error( 'mw.html.element: Illegal end tag found in CDATA' ); - } - s += contents.value; - } else { - throw new Error( 'mw.html.element: Invalid type of contents' ); + switch ( typeof contents ) { + case 'string': + // Escaped + s += this.escape( contents ); + break; + case 'number': + case 'boolean': + // Convert to string + s += '' + contents; + break; + default: + if ( contents instanceof this.Raw ) { + // Raw HTML inclusion + s += contents.value; + } else if ( contents instanceof this.Cdata ) { + // CDATA + if ( /<\/[a-zA-z]/.test( contents.value ) ) { + throw new Error( 'mw.html.element: Illegal end tag found in CDATA' ); + } + s += contents.value; + } else { + throw new Error( 'mw.html.element: Invalid type of contents' ); + } } s += ''; return s; diff --git a/resources/mediawiki/mediawiki.util.js b/resources/mediawiki/mediawiki.util.js index 71875835..59727b3d 100644 --- a/resources/mediawiki/mediawiki.util.js +++ b/resources/mediawiki/mediawiki.util.js @@ -164,12 +164,13 @@ var s = document.createElement( 'style' ); s.type = 'text/css'; s.rel = 'stylesheet'; + // Insert into document before setting cssText (bug 33305) + document.getElementsByTagName('head')[0].appendChild( s ); if ( s.styleSheet ) { s.styleSheet.cssText = text; // IE } else { s.appendChild( document.createTextNode( text + '' ) ); // Safari sometimes borks on null } - document.getElementsByTagName('head')[0].appendChild( s ); return s.sheet || s; }, -- cgit v1.2.2