File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed
Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 66< script type ="text/javascript ">
77 $ ( function ( ) {
88 $ . mask . definitions [ '~' ] = "[+-]" ;
9- $ ( "#date" ) . mask ( "99/99/9999" , { completed :function ( ) { alert ( "completed!" ) ; } } ) ;
9+ $ ( "#date" ) . mask ( "99/99/9999" )
10+ . on ( "completed.mask" , function ( ) {
11+ alert ( "completed with value: " + this . value ) ;
12+ } ) ;
1013 $ ( "#phone" ) . mask ( "(999) 999-9999" ) ;
1114 $ ( "#phoneExt" ) . mask ( "(999) 999-9999? x99999" ) ;
1215 $ ( "#iphone" ) . mask ( "+33 999 999 999" ) ;
Original file line number Diff line number Diff line change 1- feature ( "Pasting" , function ( ) {
1+ feature ( "Pasting" , function ( ) {
22 scenario ( 'When pasting a value' , function ( ) {
33 var completed = false ;
44 given ( "an input with a completed callback" , function ( ) {
5- input . mask ( "99" , { completed : function ( ) { completed = true ; } } ) ;
5+ input . mask ( "99" ) . on ( " completed.mask" , function ( ) { completed = true ; } ) ;
66 } ) ;
77
88 when ( "pasting" , function ( ) {
@@ -13,4 +13,4 @@ feature("Pasting", function() {
1313 expect ( completed ) . toBeTruthy ( ) ;
1414 } ) ;
1515 } ) ;
16- } ) ;
16+ } ) ;
Original file line number Diff line number Diff line change 7373 completed : null
7474 } , settings ) ;
7575
76- //Hardcoded as fixed for now.
76+ //Hardcoded as fixed for now.
7777 var mask = new $ . mask . masks . fixed ( format , settings ) ;
7878
7979 return this . trigger ( "unmask" ) . each ( function ( ) {
137137
138138 elm . value = result . value ;
139139 setCaret ( elm , result . pos ) ;
140- if ( result . isComplete && settings . completed )
141- settings . completed . call ( input ) ; //TODO: Raise event instead.
140+ if ( result . isComplete )
141+ input . trigger ( "completed.mask" ) ;
142+
142143 e . preventDefault ( ) ;
143144
144145 // if(android){
178179 var result = mask . apply ( elm . value , pos . end ) ;
179180 elm . value = result . value ;
180181 setCaret ( elm , result . pos ) ;
181- if ( result . isComplete && settings . completed )
182- settings . completed . call ( input ) ; //TODO: Raise event instead.
182+ if ( result . isComplete )
183+ input . trigger ( " completed.mask" ) ;
183184 } , 0 ) ;
184185 }
185186 input . data ( $ . mask . dataName , mask ) ;
You can’t perform that action at this time.
0 commit comments