MWWikitextSurfaceFragment#convertFromSource: Don't make an invalid doc

Though neat, this hack to get the internal list doesn't seem to be used
and creates an invalid document (just an internal list with no content,
so the internal list is at the start and the default selection position
is inside it). Instead, use the ve.dm.Document.static.newBlankDocument()
utility function that was made for this use case.

Bug: T153509
Change-Id: Iba5931cb5e3f939a803c1d59fa0d8f30a0513f84
This commit is contained in:
James D. Forrester 2017-03-01 19:47:23 -08:00 committed by Catrope
parent 1865702448
commit 6fd475e8ec

View file

@ -155,7 +155,7 @@ ve.dm.MWWikitextSurfaceFragment.prototype.convertFromSource = function ( source
var parsePromise;
if ( !source ) {
parsePromise = $.Deferred().resolve(
this.getDocument().cloneFromRange( new ve.Range( 0 ) )
ve.dm.Document.static.newBlankDocument()
).promise();
} else {
parsePromise = new mw.Api().post( {