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:
Roan Kattouw 2013-07-09 13:21:48 -07:00
parent fdedbb36e2
commit b77a1b2250

View file

@ -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();