mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Removed attach and detach methods from ve.ce.Node
Added some needed functionality in ve.Node to make up for this Change-Id: Ife902aceb4e8535411dc653ae61087aecf67a0c6
This commit is contained in:
parent
dc646ff32c
commit
00c555ebe5
|
@ -177,40 +177,15 @@ ve.ce.Node.getSplitableNode = function( node ) {
|
|||
ve.log(node);
|
||||
if ( node.canBeSplit() ) {
|
||||
splitableNode = node;
|
||||
return true;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
} );
|
||||
|
||||
return splitableNode;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Attaches node as a child to another node.
|
||||
*
|
||||
* @method
|
||||
* @param {ve.ce.Node} parent Node to attach to
|
||||
* @emits attach (parent)
|
||||
*/
|
||||
ve.ce.Node.prototype.attach = function( parent ) {
|
||||
this.parent = parent;
|
||||
this.emit( 'attach', parent );
|
||||
};
|
||||
|
||||
/**
|
||||
* Detaches node from its parent.
|
||||
*
|
||||
* @method
|
||||
* @emits detach (parent)
|
||||
*/
|
||||
ve.ce.Node.prototype.detach = function() {
|
||||
var parent = this.parent;
|
||||
this.parent = null;
|
||||
this.emit( 'detach', parent );
|
||||
};
|
||||
|
||||
/* Inheritance */
|
||||
|
||||
ve.extendClass( ve.ce.Node, ve.Node );
|
||||
|
|
|
@ -174,10 +174,11 @@ ve.Node.prototype.attach = function( parent ) {
|
|||
* @emits detach
|
||||
*/
|
||||
ve.Node.prototype.detach = function() {
|
||||
var parent = this.parent;
|
||||
this.parent = null;
|
||||
this.setRoot( this );
|
||||
this.setDocument();
|
||||
this.emit( 'detach' );
|
||||
this.emit( 'detach', parent );
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue