mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-26 19:56:49 +00:00
Sanity check for tokens being an array
Change-Id: Ia4e4071e1469c31e3b320d854500938bb0245f82
This commit is contained in:
parent
93ce7453f0
commit
3e0e11b1d0
|
@ -127,6 +127,9 @@ MWParserEnvironment.prototype.setTokenRank = function ( rank, token ) {
|
|||
// Strip 'end' tokens and trailing newlines
|
||||
MWParserEnvironment.prototype.stripEOFTkfromTokens = function ( tokens ) {
|
||||
this.dp( 'stripping end or whitespace tokens' );
|
||||
if ( tokens.constructor !== Array ) {
|
||||
tokens = [ tokens ];
|
||||
}
|
||||
if ( ! tokens.length ) {
|
||||
return tokens;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue