used more efficient method for .empty()
diff --git a/src/publicapi.js b/src/publicapi.js
index 615b0aa..63cd46f 100644
--- a/src/publicapi.js
+++ b/src/publicapi.js
@@ -161,7 +161,12 @@
return this;
};
_.empty = function() {
- this.select().__controller.backspace();
+ var root = this.__controller.root, cursor = this.__controller.cursor;
+ root.eachChild('postOrder', 'dispose');
+ root.ends[L] = root.ends[R] = 0;
+ root.jQ.empty();
+ delete cursor.selection;
+ cursor.insAtRightEnd(root);
return this;
};
_.cmd = function(cmd) {