@@ -34,7 +34,6 @@ var consoleNode,
3434 PRIORITY_WATCH = - 1000 ,
3535 PRIORITY_LAST = 99999 ,
3636 NOOP = 'noop' ,
37- NG_ERROR = 'ng-error' ,
3837 NG_EXCEPTION = 'ng-exception' ,
3938 NG_VALIDATION_ERROR = 'ng-validation-error' ,
4039 jQuery = window [ 'jQuery' ] || window [ '$' ] , // weirdness to make IE happy
@@ -283,10 +282,10 @@ function elementError(element, type, error) {
283282 }
284283 if ( error ) {
285284 element . addClass ( type ) ;
286- element . attr ( NG_ERROR , error ) ;
285+ element . attr ( type , error ) ;
287286 } else {
288287 element . removeClass ( type ) ;
289- element . removeAttr ( NG_ERROR ) ;
288+ element . removeAttr ( type ) ;
290289 }
291290}
292291
@@ -1222,16 +1221,7 @@ Parser.prototype = {
12221221 for ( var i = 0 ; i < argsFn . length ; i ++ ) {
12231222 args . push ( argsFn [ i ] ( self ) ) ;
12241223 }
1225- var pipeThis = function ( ) {
1226- var _this = this ;
1227- foreach ( self , function ( v , k ) {
1228- if ( k . charAt ( 0 ) == '$' ) {
1229- _this [ k ] = v ;
1230- }
1231- } ) ;
1232- } ;
1233- pipeThis . prototype = self . self ;
1234- return fn . apply ( new pipeThis ( ) , args ) ;
1224+ return fn . apply ( self . state , args ) ;
12351225 } ;
12361226 return function ( ) {
12371227 return fnInvoke ;
@@ -2883,12 +2873,17 @@ angularDirective("ng-bind-template", function(expression){
28832873 } ;
28842874} ) ;
28852875
2876+ var REMOVE_ATTRIBUTES = {
2877+ 'disabled' :true ,
2878+ 'readonly' :true ,
2879+ 'checked' :true
2880+ } ;
28862881angularDirective ( "ng-bind-attr" , function ( expression ) {
28872882 return function ( element ) {
28882883 this . $onEval ( function ( ) {
28892884 foreach ( this . $eval ( expression ) , function ( bindExp , key ) {
28902885 var value = compileBindTemplate ( bindExp ) . call ( this , element ) ;
2891- if ( key == 'disabled' && ! toBoolean ( value ) ) {
2886+ if ( REMOVE_ATTRIBUTES [ lowercase ( key ) ] && ! toBoolean ( value ) ) {
28922887 element . removeAttr ( 'disabled' ) ;
28932888 } else {
28942889 element . attr ( key , value ) ;
@@ -3129,7 +3124,7 @@ function valueAccessor(scope, element) {
31293124 required = required || required === '' ;
31303125 if ( ! validator ) throw "Validator named '" + validatorName + "' not found." ;
31313126 function validate ( value ) {
3132- var error = required && ! trim ( value ) ? "Required" : validator ( { self :scope , scope :{ get :scope . $get , set :scope . $set } } , value ) ;
3127+ var error = required && ! trim ( value ) ? "Required" : validator ( { state :scope , scope :{ get :scope . $get , set :scope . $set } } , value ) ;
31333128 if ( error !== lastError ) {
31343129 elementError ( element , NG_VALIDATION_ERROR , error ) ;
31353130 lastError = error ;
@@ -3402,7 +3397,7 @@ angularService("$location", function(browser){
34023397angularService ( "$hover" , function ( browser ) {
34033398 var tooltip , self = this , error , width = 300 , arrowWidth = 10 ;
34043399 browser . hover ( function ( element , show ) {
3405- if ( show && ( error = element . attr ( 'ng-error' ) ) ) {
3400+ if ( show && ( error = element . attr ( NG_EXCEPTION ) || element . attr ( NG_VALIDATION_ERROR ) ) ) {
34063401 if ( ! tooltip ) {
34073402 tooltip = {
34083403 callout : jqLite ( '<div id="ng-callout"></div>' ) ,
0 commit comments