r2360 - Condensed the check for a selection when pressing backspace ~ line 105
Author: powella
Date: Sun Mar 22 20:12:10 2009
New Revision: 2360
Modified:
branches/dev/mask/ui/ui.mask.js
Log:
Condensed the check for a selection when pressing backspace ~ line 105
Modified: branches/dev/mask/ui/ui.mask.js
==============================================================================
--- branches/dev/mask/ui/ui.mask.js (original)
+++ branches/dev/mask/ui/ui.mask.js Sun Mar 22 20:12:10 2009
@@ -7,7 +7,7 @@
*
* Based on the jquery.maskedinput.js plugin by Josh Bush (digitalbush.com)
*
- * http://docs.jquery.com/UI/Progressbar
+ * http://docs.jquery.com/UI/Mask
*
* Depends:
* ui.core.js
@@ -91,11 +91,6 @@
}
};
- function selection(){
- var pos = caret();
- return input.val().substring(pos.begin, pos.end);
- };
-
function keydownEvent(e) {
var pos = caret();
var k = e.keyCode;
@@ -107,7 +102,7 @@
//backspace, delete, and escape get special treatment
if (k == 8 || k == 46 || (iPhone && k == 127)) {//backspace/delete
- shiftL(pos.begin + ((k == 46 || (k == 8 && selection().length)) ? 0 :
-1));
+ shiftL(pos.begin + ((k == 46 || (k == 8 && pos.begin!=pos.end)) ? 0 :
-1));
return false;
} else if (k == 27) {//escape
input.val(focusText);