Merge "mw.htmlform: Fix hiding of the textbox for 'selectorother' fields on page...
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.Title.js
index 6765270..398adbb 100644 (file)
                        },
                        // brackets, greater than
                        {
-                               pattern: /[\]\}>]/g,
+                               pattern: /[}\]>]/g,
                                replace: ')',
                                generalRule: true
                        },
                        // brackets, lower than
                        {
-                               pattern: /[\[\{<]/g,
+                               pattern: /[{[<]/g,
                                replace: '(',
                                generalRule: true
                        },
                }
 
                // Any remaining initial :s are illegal.
-               title = title.replace( /^\:+/, '' );
+               title = title.replace( /^:+/, '' );
 
                return Title.newFromText( title, namespace );
        };
                        thumbPhpRegex = /thumb\.php/,
                        regexes = [
                                // Thumbnails
-                               /\/[a-f0-9]\/[a-f0-9]{2}\/([^\s\/]+)\/[^\s\/]+-[^\s\/]*$/,
+                               /\/[a-f0-9]\/[a-f0-9]{2}\/([^\s/]+)\/[^\s/]+-[^\s/]*$/,
 
                                // Full size images
-                               /\/[a-f0-9]\/[a-f0-9]{2}\/([^\s\/]+)$/,
+                               /\/[a-f0-9]\/[a-f0-9]{2}\/([^\s/]+)$/,
 
                                // Thumbnails in non-hashed upload directories
-                               /\/([^\s\/]+)\/[^\s\/]+-(?:\1|thumbnail)[^\s\/]*$/,
+                               /\/([^\s/]+)\/[^\s/]+-(?:\1|thumbnail)[^\s/]*$/,
 
                                // Full-size images in non-hashed upload directories
-                               /\/([^\s\/]+)$/
+                               /\/([^\s/]+)$/
                        ],
 
                        recount = regexes.length;
         */
        Title.exists = function ( title ) {
                var match,
-                       type = $.type( title ),
                        obj = Title.exist.pages;
 
-               if ( type === 'string' ) {
+               if ( typeof title === 'string' ) {
                        match = obj[ title ];
-               } else if ( type === 'object' && title instanceof Title ) {
+               } else if ( title instanceof Title ) {
                        match = obj[ title.toString() ];
                } else {
                        throw new Error( 'mw.Title.exists: title must be a string or an instance of Title' );
                }
 
-               if ( typeof match === 'boolean' ) {
-                       return match;
+               if ( typeof match !== 'boolean' ) {
+                       return null;
                }
 
-               return null;
+               return match;
        };
 
        /**