@@ -373,7 +373,7 @@ function optionsAccessor(scope, element) {
373
373
374
374
function noopAccessor ( ) { return { get : noop , set : noop } ; }
375
375
376
- var textWidget = inputWidget ( 'keyup change' , modelAccessor , valueAccessor , initWidgetValue ( ) ) ,
376
+ var textWidget = inputWidget ( 'keyup change' , modelAccessor , valueAccessor , initWidgetValue ( ) , true ) ,
377
377
buttonWidget = inputWidget ( 'click' , noopAccessor , noopAccessor , noop ) ,
378
378
INPUT_TYPE = {
379
379
'text' : textWidget ,
@@ -451,7 +451,7 @@ function radioInit(model, view, element) {
451
451
expect(binding('checkboxCount')).toBe('1');
452
452
});
453
453
*/
454
- function inputWidget ( events , modelAccessor , viewAccessor , initFn ) {
454
+ function inputWidget ( events , modelAccessor , viewAccessor , initFn , dirtyChecking ) {
455
455
return function ( element ) {
456
456
var scope = this ,
457
457
model = modelAccessor ( scope , element ) ,
@@ -463,10 +463,13 @@ function inputWidget(events, modelAccessor, viewAccessor, initFn) {
463
463
// Don't register a handler if we are a button (noopAccessor) and there is no action
464
464
if ( action || modelAccessor !== noopAccessor ) {
465
465
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
+ }
470
473
} ) ;
471
474
}
472
475
scope . $watch ( model . get , function ( value ) {
0 commit comments