Merge "Node cleanup"

This commit is contained in:
jenkins-bot 2013-02-02 00:23:03 +00:00 committed by Gerrit Code Review
commit 9a96f894ff
3 changed files with 5 additions and 12 deletions

View file

@ -290,7 +290,7 @@ ve.ce.Node.prototype.getModel = function () {
ve.ce.Node.getSplitableNode = function ( node ) {
var splitableNode = null;
ve.Node.traverseUpstream( node, function ( node ) {
node.traverseUpstream( function ( node ) {
if ( node.canBeSplit() ) {
splitableNode = node;
return true;

View file

@ -836,7 +836,7 @@ ve.ce.Surface.prototype.handleEnter = function ( e ) {
}
} else {
// Split
ve.Node.traverseUpstream( node, function ( node ) {
node.traverseUpstream( function ( node ) {
if ( !node.canBeSplit() ) {
return false;
}
@ -1026,7 +1026,7 @@ ve.ce.Surface.prototype.handleDelete = function ( e, backspace ) {
// Find the node that should be completely removed
nodeToDelete = sourceNode;
ve.Node.traverseUpstream( nodeToDelete, function ( node ) {
nodeToDelete.traverseUpstream( function ( node ) {
if ( node.getParent().children.length === 1 ) {
nodeToDelete = node.getParent();
return true;

View file

@ -23,13 +23,6 @@ ve.Node = function VeNode( type ) {
this.parent = null;
this.root = this;
this.doc = null;
// Convenience function for emitting update events - context is bound by enclosing this scope
// making it easy to pass through other functions as a callback
var node = this;
this.emitUpdate = function () {
node.emit( 'update' );
};
};
/**
@ -206,11 +199,11 @@ ve.Node.prototype.detach = function () {
*
* For each traversed node, the callback function will be passed the traversed node as a parameter.
*
* @param {ve.Node} node Node from which to start traversing
* @param {Function} callback Callback method to be called for every traversed node
* @method
*/
ve.Node.traverseUpstream = function ( node, callback ) {
ve.Node.prototype.traverseUpstream = function ( callback ) {
var node = this;
while ( node ) {
if ( callback ( node ) === false ) {
break;