It even makes more sense to accept a title object than a string.
Version: unspecified
Severity: normal
It even makes more sense to accept a title object than a string.
Version: unspecified
Severity: normal
frame:expandTemplate doesn't validate the type of its argument, and just calls tostring() on it. Since tostring( titleObj ) returns the page title, frame:expandTemplate already does accept a title object.
The only caveat is that you can't pass in a namespace-0 title object in this way, since it will be stringified without a leading colon so then frame:expandTemplate will look for it in the Template namespace instead of namespace 0.
(In reply to comment #1)
The only caveat is that you can't pass in a namespace-0 title object in this
way, since it will be stringified without a leading colon so then
frame:expandTemplate will look for it in the Template namespace instead of
namespace 0.
This is the reason I filed this bug.
(In reply to comment #2)
(In reply to comment #1)
The only caveat is that you can't pass in a namespace-0 title object in this
way, since it will be stringified without a leading colon so then
frame:expandTemplate will look for it in the Template namespace instead of
namespace 0.This is the reason I filed this bug.
You should have stated that in your original description.
This should be easy enough with the same sort of check used in mw.message's title() method, just prepend the necessary colon if the passed value is a table with .namespace == 0.
Change 125207 had a related patch set uploaded by Happy5214:
Accept mw.title object as the title argument of frame:expandTemplate()
Change 125207 merged by jenkins-bot:
Accept mw.title object as the title argument of frame:expandTemplate()
The change should be deployed to WMF wikis with 1.24wmf1, see https://www.mediawiki.org/wiki/MediaWiki_1.24/Roadmap for the schedule.