Only remove from internal list if unroot from correct document

Bug: T163267
Change-Id: I11ff56fbd437e46aab516a50235f8077eea0af5b
This commit is contained in:
Ed Sanders 2017-04-20 16:15:08 +01:00
parent 5b477ce3a1
commit 1fe0fb2e70
2 changed files with 6 additions and 4 deletions

View file

@ -29,7 +29,6 @@ QUnit.test( 'convert', function ( assert ) {
'</ol>',
annotations: [],
expectedData: [
{ type: 'paragraph' },
{
type: 'mwReference',
attributes: {
@ -50,7 +49,6 @@ QUnit.test( 'convert', function ( assert ) {
}
},
{ type: '/mwReference' },
{ type: '/paragraph' },
{ type: 'internalList' },
{ type: 'internalItem' },
{ type: 'paragraph', internal: { generated: 'wrapper' } },

View file

@ -365,9 +365,13 @@ ve.dm.MWReferenceNode.prototype.onRoot = function () {
/**
* Handle the node being detached from the root
*
* @param {ve.dm.DocumentNode} oldRoot Old document root
*/
ve.dm.MWReferenceNode.prototype.onUnroot = function () {
this.removeFromInternalList();
ve.dm.MWReferenceNode.prototype.onUnroot = function ( oldRoot ) {
if ( this.getDocument().getDocumentNode() === oldRoot ) {
this.removeFromInternalList();
}
};
/**