Make pushReplace([], []) do nothing

Change-Id: Ifa8df99f376ce22add9d06e76831e8b661e6ddbf
This commit is contained in:
Catrope 2012-06-06 10:58:08 -07:00
parent 2439c0149a
commit d39fb9dd1c

View file

@ -262,6 +262,10 @@ ve.dm.Transaction.prototype.pushRetain = function( length ) {
* @param {Array] insert Data to replace 'remove' with
*/
ve.dm.Transaction.prototype.pushReplace = function( remove, insert ) {
if ( remove.length === 0 && insert.length === 0 ) {
// Don't push no-ops
return;
}
this.operations.push( {
'type': 'replace',
'remove': remove,