mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-24 18:58:42 +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
|
@ -186,31 +186,6 @@ ve.ce.Node.getSplitableNode = function( node ) {
|
|||
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