Merge "Don't drop annotated comments in wrappers"

This commit is contained in:
jenkins-bot 2013-06-25 22:54:42 +00:00 committed by Gerrit Code Review
commit 2b7e47b8ab
2 changed files with 43 additions and 1 deletions

View file

@ -844,7 +844,9 @@ ve.dm.Converter.prototype.getDataFromDomRecursion = function ( domElement, wrapp
childDataElements[0].annotations = context.annotations.getIndexes().slice();
}
if ( context.inWrapper ) {
// Queue wrapped meta items only if it's actually possible for us to move them out
// of the wrapper
if ( context.inWrapper && context.canCloseWrapper ) {
wrappedMetaItems = wrappedMetaItems.concat( childDataElements );
if ( wrappedWhitespace !== '' ) {
data.splice( wrappedWhitespaceIndex, wrappedWhitespace.length );

View file

@ -1549,6 +1549,46 @@ ve.dm.example.domToDataCases = {
{ 'type': '/internalList' }
]
},
'annotated metadata in a wrapper': {
'html': '<body><b><!--foo-->bar<!--baz-->quux<!--whee--></b></body>',
'data': [
{ 'type': 'paragraph', 'internal': { 'generated': 'wrapper' } },
{
'type': 'alienMeta',
'annotations': [ ve.dm.example.bold ],
'attributes': {
'domElements': $( '<!--foo-->' ).toArray()
}
},
{ 'type': '/alienMeta' },
[ 'b', [ ve.dm.example.bold ] ],
[ 'a', [ ve.dm.example.bold ] ],
[ 'r', [ ve.dm.example.bold ] ],
{
'type': 'alienMeta',
'annotations': [ ve.dm.example.bold ],
'attributes': {
'domElements': $( '<!--baz-->' ).toArray()
}
},
{ 'type': '/alienMeta' },
[ 'q', [ ve.dm.example.bold ] ],
[ 'u', [ ve.dm.example.bold ] ],
[ 'u', [ ve.dm.example.bold ] ],
[ 'x', [ ve.dm.example.bold ] ],
{
'type': 'alienMeta',
'annotations': [ ve.dm.example.bold ],
'attributes': {
'domElements': $( '<!--whee-->' ).toArray()
}
},
{ 'type': '/alienMeta' },
{ 'type': '/paragraph' },
{ 'type': 'internalList' },
{ 'type': '/internalList' }
]
},
'wrapping of bare content': {
'html': '<body>abc</body>',
'data': [