Merge "(bug 41477) Add Language::isSupportedLanguage"
[lhc/web/wiklou.git] / resources / mediawiki / mediawiki.Title.js
index 6b6e586..dad6021 100644 (file)
        }
 
 var
+       /**
+        * Public methods (defined later)
+        */
+       fn,
+
        /**
         * Strip some illegal chars: control chars, colon, less than, greater than,
         * brackets, braces, pipe, whitespace and normal spaces. This still leaves some insanity
@@ -127,12 +132,12 @@ var
        setAll = function ( title, s ) {
                // In normal browsers the match-array contains null/undefined if there's no match,
                // IE returns an empty string.
-               var     matches = s.match( /^(?:([^:]+):)?(.*?)(?:\.(\w{1,5}))?$/ ),
-                       ns_match = getNsIdByName( matches[1] );
+               var matches = s.match( /^(?:([^:]+):)?(.*?)(?:\.(\w+))?$/ ),
+                       nsMatch = getNsIdByName( matches[1] );
 
                // Namespace must be valid, and title must be a non-empty string.
-               if ( ns_match && typeof matches[2] === 'string' && matches[2] !== '' ) {
-                       title.ns = ns_match;
+               if ( nsMatch && typeof matches[2] === 'string' && matches[2] !== '' ) {
+                       title.ns = nsMatch;
                        title.name = fixName( matches[2] );
                        if ( typeof matches[3] === 'string' && matches[3] !== '' ) {
                                title.ext = fixExt( matches[3] );
@@ -155,7 +160,7 @@ var
        setNameAndExtension = function ( title, raw ) {
                // In normal browsers the match-array contains null/undefined if there's no match,
                // IE returns an empty string.
-               var matches = raw.match( /^(?:)?(.*?)(?:\.(\w{1,5}))?$/ );
+               var matches = raw.match( /^(?:)?(.*?)(?:\.(\w+))?$/ );
 
                // Title must be a non-empty string.
                if ( typeof matches[1] === 'string' && matches[1] !== '' ) {
@@ -221,7 +226,7 @@ var
 
        /* Public methods */
 
-       var fn = {
+       fn = {
                constructor: Title,
 
                /**