Implement mw.Title in core
authorKrinkle <krinkle@users.mediawiki.org>
Thu, 16 Jun 2011 21:16:50 +0000 (21:16 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Thu, 16 Jun 2011 21:16:50 +0000 (21:16 +0000)
commit8f2c463b25faf162d51bc9d6f8edcd4865f4db0f
treef2eeadaab767c648a3f2ee9e1889619e41eb890a
parentefbd16e8257bfc9fd2d7a1e4415fd450c1679334
Implement mw.Title in core
* Based on UploadWizard/resources/mw.Title.js
* Refactored to use local scope and prototypes instead of per-instance private scope (less references, faster instantiation)
* Fix potential ReferenceError in the check for wgArticlePath (inline if statements will fail to evaluate for undeclared variables). Using mw.config instead
* The following were not ported because they are or were already redundant and/or merged with another method:
-- setNameText (redundant with the improved setName)
-- setPrefix (redundant wit the improved setNamespace)
* Ported all jasmine tests to QUnit. Left them exactly the same to make sure it's compatible with UploadWizard. Perhaps I'll expand or adjust the suite later to be less file-specific, but for now make sure it's compatible and the same.

@todo FIXME

* Removed assumption that every title has a namespace prefix in it by creating a separate RegExp when there is a namespace given

** Fixes strip-bug in cases where a namespace appears to be part of a title when the namespace is also given: "Project:User:Foobar"

new mw.Title( 'User:Foobar', 4 ).toString()
> 'Project:Foobar'

** Fixes a thrown exception in case a colon is part of the title (colons are valid in MediaWiki pagenames!)

new mw.Title( 'Just some:Random page')
> Error: mw.Title> Unrecognized canonical namespace: just_some

* Added check for capitalLinks et (wasn't possible before due to bug X)

** Prevents breakages on wiktionary and other wikis with case sensitivity.
includes/resourceloader/ResourceLoaderStartUpModule.php