Merge "Use regular slaves for user contribs parent revision queries"
[lhc/web/wiklou.git] / resources / mediawiki / mediawiki.Title.js
index e1031c6..32c3f1e 100644 (file)
                        // Trim underscores
                        .replace( rUnderscoreTrim, '' );
 
-               if ( title === '' ) {
-                       return false;
-               }
-
                // Process initial colon
-               if ( title.charAt( 0 ) === ':' ) {
+               if ( title !== '' && title.charAt( 0 ) === ':' ) {
                        // Initial colon means main namespace instead of specified default
                        namespace = NS_MAIN;
                        title = title
                                .replace( rUnderscoreTrim, '' );
                }
 
+               if ( title === '' ) {
+                       return false;
+               }
+
                // Process namespace prefix (if any)
                m = title.match( rSplit );
                if ( m ) {
                                title.indexOf( '../' ) === 0 ||
                                title.indexOf( '/./' ) !== -1 ||
                                title.indexOf( '/../' ) !== -1 ||
-                               title.substr( -2 ) === '/.' ||
-                               title.substr( -3 ) === '/..'
+                               title.substr( title.length - 2 ) === '/.' ||
+                               title.substr( title.length - 3 ) === '/..'
                        )
                ) {
                        return false;
 
                /**
                 * Example to declare existing titles:
-                *     Title.exist.set(['User:John_Doe', ...]);
+                *     Title.exist.set( ['User:John_Doe', ...] );
                 * Eample to declare titles nonexistent:
-                *     Title.exist.set(['File:Foo_bar.jpg', ...], false);
+                *     Title.exist.set( ['File:Foo_bar.jpg', ...], false );
                 *
                 * @static
                 * @property exist.set