@@ -373,7 +373,7 @@ function optionsAccessor(scope, element) {
373373
374374function noopAccessor ( ) { return { get : noop , set : noop } ; }
375375
376- var textWidget = inputWidget ( 'keyup change' , modelAccessor , valueAccessor , initWidgetValue ( ) ) ,
376+ var textWidget = inputWidget ( 'keyup change' , modelAccessor , valueAccessor , initWidgetValue ( ) , true ) ,
377377 buttonWidget = inputWidget ( 'click' , noopAccessor , noopAccessor , noop ) ,
378378 INPUT_TYPE = {
379379 'text' : textWidget ,
@@ -451,7 +451,7 @@ function radioInit(model, view, element) {
451451 expect(binding('checkboxCount')).toBe('1');
452452 });
453453 */
454- function inputWidget ( events , modelAccessor , viewAccessor , initFn ) {
454+ function inputWidget ( events , modelAccessor , viewAccessor , initFn , dirtyChecking ) {
455455 return function ( element ) {
456456 var scope = this ,
457457 model = modelAccessor ( scope , element ) ,
@@ -463,10 +463,13 @@ function inputWidget(events, modelAccessor, viewAccessor, initFn) {
463463 // Don't register a handler if we are a button (noopAccessor) and there is no action
464464 if ( action || modelAccessor !== noopAccessor ) {
465465 element . bind ( events , function ( ) {
466- model . set ( view . get ( ) ) ;
467- lastValue = model . get ( ) ;
468- scope . $tryEval ( action , element ) ;
469- scope . $root . $eval ( ) ;
466+ var value = view . get ( ) ;
467+ if ( ! dirtyChecking || value != lastValue ) {
468+ model . set ( value ) ;
469+ lastValue = model . get ( ) ;
470+ scope . $tryEval ( action , element ) ;
471+ scope . $root . $eval ( ) ;
472+ }
470473 } ) ;
471474 }
472475 scope . $watch ( model . get , function ( value ) {
0 commit comments