mediawiki.Title: Change internal 'title' field to include file extension
authorThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Mon, 13 May 2019 09:20:32 +0000 (11:20 +0200)
committerKrinkle <krinklemail@gmail.com>
Sun, 8 Sep 2019 02:55:12 +0000 (02:55 +0000)
commit0915fa7a836b755d6706247966fed65e6afeca4d
treed3e65b4800fe2cc85139655e05acdd5ee24b71c7
parente3b5ed406ec4d04b2744d9a377446ead8eb0ca50
mediawiki.Title: Change internal 'title' field to include file extension

I found the separation of 'ext' from 'title' very suprising, and an actual
source of errors, confusion and misunderstandings.

Before this change, the private parse() helper function returned a "title"
property that did not contain the real title, but only the part of a
file-related title without its file extension, basically assuming
every title is a file name. And for normal titles, every method had to
remember to combine "title" and ext".

This patch moves the file name and file extension extraction code to the
only places where it is actually needed: The two methods getName() and
getExtension() return file name and extension as separate substrings.
Note how this code is barely used anywhere. Almost all code (except a
few places in UploadWizard, MultiMediaViewer, and such) works with the
full title. With this patch constructing mw.Title objects will become a
little faster on average.

Change-Id: I6618118557b12224f2405d83f539bee54646bb63
resources/src/mediawiki.Title/Title.js