mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-27 04:06:51 +00:00
Fix for check if data is balanced
Previous check wouldn't make sense, cause the last offset in the data could be that one that makes data balanced (and j is increased always after iteration). Change-Id: Ie9498d0ac9e3417d09b8b3043bf3281e7dfbf9db
This commit is contained in:
parent
c1477bc1da
commit
02d522500c
|
@ -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' ];
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -3122,6 +3122,24 @@ ve.dm.example.domToDataCases = {
|
|||
{ 'type': '/paragraph' },
|
||||
{ 'type': '/div' }
|
||||
]
|
||||
},
|
||||
'thumb image': {
|
||||
'html': '<body><figure typeof="mw:Image/Thumb"><a rel="mw:thumb" href="Foo"><img src="Bar" width="1" height="2" resource="FooBar"></a></figure></body>',
|
||||
'data': [
|
||||
{
|
||||
'type': 'MWblockimage',
|
||||
'attributes': {
|
||||
'type': 'thumb',
|
||||
'align': 'right',
|
||||
'href': 'Foo',
|
||||
'src': 'Bar',
|
||||
'width': '1',
|
||||
'height': '2',
|
||||
'resource': 'FooBar'
|
||||
}
|
||||
},
|
||||
{ 'type': '/MWblockimage' }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue