diff --git a/modules/ve/dm/nodes/ve.dm.MWBlockImageNode.js b/modules/ve/dm/nodes/ve.dm.MWBlockImageNode.js index 411f3401bc..63908d8dc3 100644 --- a/modules/ve/dm/nodes/ve.dm.MWBlockImageNode.js +++ b/modules/ve/dm/nodes/ve.dm.MWBlockImageNode.js @@ -26,6 +26,8 @@ ve.inheritClass( ve.dm.MWBlockImageNode, ve.dm.BranchNode ); ve.dm.MWBlockImageNode.static.name = 'MWblockimage'; +ve.dm.MWBlockImageNode.static.storeHtmlAttributes = [ 'data-parsoid' ]; + ve.dm.MWBlockImageNode.static.handlesOwnChildren = true; ve.dm.MWBlockImageNode.static.childNodeTypes = [ 'MWimagecaption' ]; diff --git a/modules/ve/dm/ve.dm.Converter.js b/modules/ve/dm/ve.dm.Converter.js index 0bb23bd97d..fdc6e0f282 100644 --- a/modules/ve/dm/ve.dm.Converter.js +++ b/modules/ve/dm/ve.dm.Converter.js @@ -973,7 +973,7 @@ ve.dm.Converter.prototype.getDomSubtreeFromData = function ( data, container ) { } j++; } - if ( j >= data.length ) { + if ( depth !== 0 ) { throw new Error( 'Unbalanced data: looking for closing /' + dataElement.type ); } diff --git a/modules/ve/test/dm/ve.dm.example.js b/modules/ve/test/dm/ve.dm.example.js index 3d6c7c737c..6e4c29abde 100644 --- a/modules/ve/test/dm/ve.dm.example.js +++ b/modules/ve/test/dm/ve.dm.example.js @@ -3122,6 +3122,24 @@ ve.dm.example.domToDataCases = { { 'type': '/paragraph' }, { 'type': '/div' } ] + }, + 'thumb image': { + 'html': '
', + 'data': [ + { + 'type': 'MWblockimage', + 'attributes': { + 'type': 'thumb', + 'align': 'right', + 'href': 'Foo', + 'src': 'Bar', + 'width': '1', + 'height': '2', + 'resource': 'FooBar' + } + }, + { 'type': '/MWblockimage' } + ] } };