Merge "Use interwiki cache directly to resolve transwiki import sources"
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.Uri.js
index 7563ae4..9d29b4c 100644 (file)
                                                // Only copy direct properties, not inherited ones
                                                if ( uri.hasOwnProperty( prop ) ) {
                                                        // Deep copy object properties
-                                                       if ( $.isArray( uri[prop] ) || $.isPlainObject( uri[prop] ) ) {
-                                                               this[prop] = $.extend( true, {}, uri[prop] );
+                                                       if ( $.isArray( uri[ prop ] ) || $.isPlainObject( uri[ prop ] ) ) {
+                                                               this[ prop ] = $.extend( true, {}, uri[ prop ] );
                                                        } else {
-                                                               this[prop] = uri[prop];
+                                                               this[ prop ] = uri[ prop ];
                                                        }
                                                }
                                        }
                                        this.port = defaultUri.port;
                                }
                        }
-                       if ( this.path && this.path[0] !== '/' ) {
+                       if ( this.path && this.path[ 0 ] !== '/' ) {
                                // A real relative URL, relative to defaultUri.path. We can't really handle that since we cannot
                                // figure out whether the last path component of defaultUri.path is a directory or a file.
                                throw new Error( 'Bad constructor arguments' );
                         */
                        parse: function ( str, options ) {
                                var q, matches,
-                                       uri = this;
+                                       uri = this,
+                                       hasOwn = Object.prototype.hasOwnProperty;
 
                                // Apply parser regex and set all properties based on the result
                                matches = parser[ options.strictMode ? 'strict' : 'loose' ].exec( str );
 
                                                        // If overrideKeys, always (re)set top level value.
                                                        // If not overrideKeys but this key wasn't set before, then we set it as well.
-                                                       if ( options.overrideKeys || q[ k ] === undefined ) {
+                                                       if ( options.overrideKeys || !hasOwn.call( q, k ) ) {
                                                                q[ k ] = v;
 
                                                        // Use arrays if overrideKeys is false and key was already seen before