File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change 1414 '9' : "[0-9]" ,
1515 'a' : "[A-Za-z]" ,
1616 '*' : "[A-Za-z0-9]"
17- }
17+ } ,
18+ dataName :"rawMaskFn"
1819 } ;
1920
2021 $ . fn . extend ( {
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 : "_" ,
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 ;
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 ( ) ;
You can’t perform that action at this time.
0 commit comments