From: Neil Kandalgaonkar Date: Tue, 2 Aug 2011 20:51:20 +0000 (+0000) Subject: break dependency on utility functions isEmpty & isDefined X-Git-Tag: 1.31.0-rc.0~28476 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=d37fab81b385d20ee646dff28ffb76706083d6a7;p=lhc%2Fweb%2Fwiklou.git break dependency on utility functions isEmpty & isDefined --- diff --git a/resources/mediawiki/mediawiki.uri.js b/resources/mediawiki/mediawiki.uri.js index a7cdf3dc14..0fad926e06 100644 --- a/resources/mediawiki/mediawiki.uri.js +++ b/resources/mediawiki/mediawiki.uri.js @@ -8,7 +8,7 @@ * * Intended to compress very well if you use a JS-parsing minifier. * - * Dependencies: mw, mw.Utilities, jQuery + * Dependencies: mw, jQuery * * Example: * @@ -64,7 +64,7 @@ */ mw.uri = function( uri, strictMode ) { strictMode = !!strictMode; - if ( !mw.isEmpty( uri ) ) { + if ( typeof uri !== 'undefined' && uri !== null || uri !== '' ) { if ( typeof uri === 'string' ) { this._parse( uri, strictMode ); } else if ( typeof uri === 'object' ) { @@ -72,7 +72,7 @@ $.each( this._properties, function( i, property ) { _this[property] = uri[property]; } ); - if ( !mw.isDefined( this.query ) ) { + if ( typeof this.query === 'undefined' ) { this.query = {}; } } @@ -114,7 +114,11 @@ * @return {String} */ function _cat( pre, val, post, raw ) { - return mw.isEmpty( val ) ? '' : pre + ( raw ? val : mw.uri.encode( val ) ) + post; + if ( typeof val === 'undefined' || val === null || val === '' ) { + return ''; + } else { + return pre + ( raw ? val : mw.uri.encode( val ) ) + post; + } } mw.uri.prototype = {