* directly, passing invalid titles will result in an exception. Use #newFromText to use the
* logic directly and get null for invalid titles which is easier to work with.
*
- * @class mw.Title
- */
- /**
* Note that in the constructor and #newFromText method, `namespace` is the **default** namespace
* only, and can be overridden by a namespace prefix in `title`. If you do not want this behavior,
* use #makeTitle. Compare:
* mw.Title.newFromText( 'Template:Foo', NS_TEMPLATE ).getPrefixedText(); // => 'Template:Foo'
* mw.Title.makeTitle( NS_TEMPLATE, 'Template:Foo' ).getPrefixedText(); // => 'Template:Template:Foo'
*
- * @method constructor
+ * @class mw.Title
+ * @constructor
* @param {string} title Title of the page. If no second argument given,
* this will be searched for a namespace
* @param {number} [namespace=NS_MAIN] If given, will used as default namespace for the given title
this.title = parsed.title;
this.ext = parsed.ext;
this.fragment = parsed.fragment;
-
- return this;
}
/* Private members */
var i, len,
pages = this.pages;
- titles = $.isArray( titles ) ? titles : [ titles ];
+ titles = Array.isArray( titles ) ? titles : [ titles ];
state = state === undefined ? true : !!state;
for ( i = 0, len = titles.length; i < len; i++ ) {
) {
return this.title;
}
- return this.title[ 0 ].toUpperCase() + this.title.slice( 1 );
+ // PHP's strtoupper differs from String.toUpperCase in a number of cases
+ // Bug: T147646
+ return mw.Title.phpCharToUpper( this.title[ 0 ] ) + this.title.slice( 1 );
},
/**