Merge "Serialize alienated context-sensitive nodes correctly"

This commit is contained in:
jenkins-bot 2013-04-18 11:10:37 +00:00 committed by Gerrit Code Review
commit 17a93e96ec
2 changed files with 21 additions and 1 deletions

View file

@ -45,7 +45,7 @@ ve.dm.AlienNode.static.toDataElement = function ( domElements, converter ) {
ve.dm.AlienNode.static.toDomElements = function ( dataElement, doc ) {
var wrapper = doc.createElement( 'div' );
wrapper.innerHTML = dataElement.attributes.html;
$( wrapper ).html( dataElement.attributes.html );
// Convert wrapper.children to an array
return Array.prototype.slice.call( wrapper.childNodes, 0 );
};

View file

@ -2094,6 +2094,26 @@ ve.dm.example.domToDataCases = {
{ 'type': '/paragraph' }
]
},
'context-sensitive nodes are alienated correctly': {
'html': '<table><caption>Foo</caption><tbody><tr><td>Bar</td></tr></tbody></table>',
'data': [
{ 'type': 'table' },
{ 'type': 'alienBlock', 'attributes': { 'html': '<caption>Foo</caption>' } },
{ 'type': '/alienBlock' },
{ 'type': 'tableSection', 'attributes': { 'style': 'body' } },
{ 'type': 'tableRow' },
{ 'type': 'tableCell', 'attributes': { 'style': 'data' } },
{ 'type': 'paragraph', 'internal': { 'generated': 'wrapper' } },
'B',
'a',
'r',
{ 'type': '/paragraph' },
{ 'type': '/tableCell' },
{ 'type': '/tableRow' },
{ 'type': '/tableSection' },
{ 'type': '/table' }
]
},
'whitespace before meta node in wrapping mode': {
'html': '<body><table><tbody><tr><td>Foo\n<meta property="mw:foo" content="bar" /></td></tr></tbody></table></body>',
'data': [