forked from 0x2620/oxjs
rather use ''.slice than ''.substr
This commit is contained in:
parent
f990f3b857
commit
1608664bb6
20 changed files with 69 additions and 71 deletions
|
|
@ -513,7 +513,7 @@ Ox.Input = function(options, self) {
|
|||
} else if (/\./.test(value) && self.options.decimals) {
|
||||
length = value.split('.')[1].length;
|
||||
if (length > self.options.decimals) {
|
||||
value = value.substr(0, value.indexOf('.') + 1 + self.options.decimals);
|
||||
value = value.slice(0, value.indexOf('.') + 1 + self.options.decimals);
|
||||
cursor = [oldCursor[0] + 1, oldCursor[1] + 1];
|
||||
} else if (length < self.options.decimals) {
|
||||
value += Ox.repeat('0', self.options.decimals - length);
|
||||
|
|
@ -527,7 +527,7 @@ Ox.Input = function(options, self) {
|
|||
}
|
||||
}
|
||||
while (/^0\d/.test(value)) {
|
||||
value = value.substr(1, value.length);
|
||||
value = value.slice(1);
|
||||
}
|
||||
if (!regexp.test(value) || value < self.options.min || value > self.options.max) {
|
||||
value = oldValue;
|
||||
|
|
@ -725,7 +725,7 @@ Ox.Input = function(options, self) {
|
|||
that.triggerEvent('insert', {
|
||||
end: input.selectionEnd,
|
||||
id: that.oxid,
|
||||
selection: input.value.substring(input.selectionStart, input.selectionEnd),
|
||||
selection: input.value.slice(input.selectionStart, input.selectionEnd),
|
||||
start: input.selectionStart,
|
||||
value: input.value
|
||||
});
|
||||
|
|
@ -734,7 +734,7 @@ Ox.Input = function(options, self) {
|
|||
function keydown(event) {
|
||||
var oldCursor = cursor(),
|
||||
oldValue = self.options.value,
|
||||
newValue = oldValue.substr(0, oldCursor[0] - 1),
|
||||
newValue = oldValue.slice(0, oldCursor[0] - 1),
|
||||
hasDeletedSelectedEnd = (event.keyCode == 8 || event.keyCode == 46) &&
|
||||
oldCursor[0] < oldCursor[1] && oldCursor[1] == oldValue.length;
|
||||
if (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue