mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 19:26:46 +00:00
Defer conversion in the sanity check
Conversion is apparently pretty slow on large articles, so put it inside the setTimeout(). We still need to copy the data array synchronously though. Change-Id: Ic0c6d190c9b782f8c643d00d335f0e004d860bcf
This commit is contained in:
parent
fdedbb36e2
commit
b77a1b2250
|
@ -920,7 +920,7 @@ ve.init.mw.ViewPageTarget.prototype.startSanityCheck = function () {
|
|||
// but we can defer the actual comparison
|
||||
var viewPage = this,
|
||||
doc = viewPage.surface.getModel().getDocument(),
|
||||
newDom = ve.dm.converter.getDomFromData( doc.getFullData(), doc.getStore(), doc.getInternalList() ),
|
||||
data = ve.copyArray( doc.getFullData() ),
|
||||
oldDom = viewPage.doc,
|
||||
d = $.Deferred();
|
||||
|
||||
|
@ -932,7 +932,9 @@ ve.init.mw.ViewPageTarget.prototype.startSanityCheck = function () {
|
|||
// We can't compare oldDom.body and newDom.body directly, because the attributes on the
|
||||
// <body> were ignored in the conversion. So compare each child separately.
|
||||
var i,
|
||||
len = oldDom.body.childNodes.length;
|
||||
len = oldDom.body.childNodes.length,
|
||||
newDom = ve.dm.converter.getDomFromData( data, doc.getStore(), doc.getInternalList() );
|
||||
|
||||
if ( len !== newDom.body.childNodes.length ) {
|
||||
// Different number of children, so they're definitely different
|
||||
d.reject();
|
||||
|
|
Loading…
Reference in a new issue