Skip to content

Commit 9dba9a6

Browse files
committed
fixing function which returns raw value to not include placeholders.
*This will break any code which was depending on the data elements "buffer" or "tests".
1 parent 6721a8b commit 9dba9a6

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/jquery.maskedinput.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
'9': "[0-9]",
1515
'a': "[A-Za-z]",
1616
'*': "[A-Za-z0-9]"
17-
}
17+
},
18+
dataName:"rawMaskFn"
1819
};
1920

2021
$.fn.extend({
@@ -50,10 +51,7 @@
5051
mask: function(mask, settings) {
5152
if (!mask && this.length > 0) {
5253
var input = $(this[0]);
53-
var tests = input.data("tests");
54-
return $.map(input.data("buffer"), function(c, i) {
55-
return tests[i] ? c : null;
56-
}).join('');
54+
return input.data($.mask.dataName)();
5755
}
5856
settings = $.extend({
5957
placeholder: "_",
@@ -85,8 +83,6 @@
8583
var ignore = false; //Variable for ignoring control keys
8684
var focusText = input.val();
8785

88-
input.data("buffer", buffer).data("tests", tests);
89-
9086
function seekNext(pos) {
9187
while (++pos <= len && !tests[pos]);
9288
return pos;
@@ -213,13 +209,19 @@
213209
return (partialPosition ? i : firstNonMaskPos);
214210
};
215211

212+
input.data($.mask.dataName,function(){
213+
var pos=checkVal(true);
214+
return $.map(buffer, function(c, i) {
215+
return tests[i]&&i<pos ? c : null;
216+
}).join('');
217+
})
218+
216219
if (!input.attr("readonly"))
217220
input
218221
.one("unmask", function() {
219222
input
220223
.unbind(".mask")
221-
.removeData("buffer")
222-
.removeData("tests");
224+
.removeData($.mask.dataName);
223225
})
224226
.bind("focus.mask", function() {
225227
focusText = input.val();

0 commit comments

Comments
 (0)