Support for nodes that handles their own children in ve.dm.Converter.prototype.getDomSubtreeFromData

Change-Id: I784dec71d3f0b23001075234e324a8e06a6cfc6b
This commit is contained in:
Inez Korczyński 2013-05-16 15:29:48 -07:00
parent 57a2de90aa
commit 531c049679

View file

@ -921,6 +921,7 @@ ve.dm.Converter.prototype.getDomSubtreeFromData = function ( data, container ) {
var dataSlice, j, depth,
handlesOwn = false;
// TODO: Shouldn't be implemented with try..catch cause it makes debugging harder and sacrifice performance.
try {
handlesOwn = ve.dm.nodeFactory.doesNodeHandleOwnChildren( data[i].type );
} catch ( e ) {}
@ -1225,6 +1226,17 @@ ve.dm.Converter.prototype.getDomSubtreeFromData = function ( data, container ) {
);
}
}
// In case of nodes that handles own children ascend to parent node.
// It looks like the solution would be to avoid descending first ( so ascending
// wouldn't be needed ) but note that then code above for handling white spaces
// wouldn't execute correctly.
// TODO: Shouldn't be implemented with try..catch cause it makes debugging harder and sacrifice performance.
try {
if ( ve.dm.nodeFactory.doesNodeHandleOwnChildren( data[i].type ) ) {
domElement = parentDomElement;
}
} catch ( e ) {}
}
if ( ve.isArray( dataElementOrSlice ) ) {