mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 14:56:20 +00:00
Merge "Serialize alienated context-sensitive nodes correctly"
This commit is contained in:
commit
17a93e96ec
|
@ -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 );
|
||||
};
|
||||
|
|
|
@ -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': [
|
||||
|
|
Loading…
Reference in a new issue