@@ -1635,7 +1635,7 @@ var angularFilterGoogleChartApi;
16351635
16361636foreach ( {
16371637 'currency' : function ( amount ) {
1638- jQuery ( this . element ) . toggleClass ( 'ng-format-negative' , amount < 0 ) ;
1638+ jQuery ( this . $ element) . toggleClass ( 'ng-format-negative' , amount < 0 ) ;
16391639 return '$' + angularFilter [ 'number' ] . apply ( this , [ amount , 2 ] ) ;
16401640 } ,
16411641
@@ -1671,7 +1671,7 @@ foreach({
16711671 } ,
16721672
16731673 'json' : function ( object ) {
1674- jQuery ( this . element ) . addClass ( "ng-monospace" ) ;
1674+ jQuery ( this . $ element) . addClass ( "ng-monospace" ) ;
16751675 return toJson ( object , true ) ;
16761676 } ,
16771677
@@ -2488,7 +2488,16 @@ Parser.prototype = {
24882488 for ( var i = 0 ; i < argsFn . length ; i ++ ) {
24892489 args . push ( argsFn [ i ] ( self ) ) ;
24902490 }
2491- return fn . apply ( self , args ) ;
2491+ var pipeThis = function ( ) {
2492+ var _this = this ;
2493+ foreach ( self , function ( v , k ) {
2494+ if ( k . charAt ( 0 ) == '$' ) {
2495+ _this [ k ] = v ;
2496+ }
2497+ } ) ;
2498+ } ;
2499+ pipeThis . prototype = self . self ;
2500+ return fn . apply ( new pipeThis ( ) , args ) ;
24922501 } ;
24932502 return function ( ) {
24942503 return fnInvoke ;
@@ -2541,48 +2550,30 @@ Parser.prototype = {
25412550 } ,
25422551
25432552 logicalAND : function ( ) {
2544- var left = this . negated ( ) ;
2553+ var left = this . equality ( ) ;
25452554 var token ;
2546- while ( true ) {
2547- if ( ( token = this . expect ( '&&' ) ) ) {
2548- left = this . _binary ( left , token . fn , this . negated ( ) ) ;
2549- } else {
2550- return left ;
2551- }
2552- }
2553- } ,
2554-
2555- negated : function ( ) {
2556- var token ;
2557- if ( token = this . expect ( '!' ) ) {
2558- return this . _unary ( token . fn , this . assignment ( ) ) ;
2559- } else {
2560- return this . equality ( ) ;
2555+ if ( ( token = this . expect ( '&&' ) ) ) {
2556+ left = this . _binary ( left , token . fn , this . logicalAND ( ) ) ;
25612557 }
2558+ return left ;
25622559 } ,
25632560
25642561 equality : function ( ) {
25652562 var left = this . relational ( ) ;
25662563 var token ;
2567- while ( true ) {
2568- if ( ( token = this . expect ( '==' , '!=' ) ) ) {
2569- left = this . _binary ( left , token . fn , this . relational ( ) ) ;
2570- } else {
2571- return left ;
2572- }
2564+ if ( ( token = this . expect ( '==' , '!=' ) ) ) {
2565+ left = this . _binary ( left , token . fn , this . equality ( ) ) ;
25732566 }
2567+ return left ;
25742568 } ,
25752569
25762570 relational : function ( ) {
25772571 var left = this . additive ( ) ;
25782572 var token ;
2579- while ( true ) {
2580- if ( ( token = this . expect ( '<' , '>' , '<=' , '>=' ) ) ) {
2581- left = this . _binary ( left , token . fn , this . additive ( ) ) ;
2582- } else {
2583- return left ;
2584- }
2573+ if ( token = this . expect ( '<' , '>' , '<=' , '>=' ) ) {
2574+ left = this . _binary ( left , token . fn , this . relational ( ) ) ;
25852575 }
2576+ return left ;
25862577 } ,
25872578
25882579 additive : function ( ) {
@@ -2608,7 +2599,9 @@ Parser.prototype = {
26082599 if ( this . expect ( '+' ) ) {
26092600 return this . primary ( ) ;
26102601 } else if ( token = this . expect ( '-' ) ) {
2611- return this . _binary ( Parser . ZERO , token . fn , this . multiplicative ( ) ) ;
2602+ return this . _binary ( Parser . ZERO , token . fn , this . unary ( ) ) ;
2603+ } else if ( token = this . expect ( '!' ) ) {
2604+ return this . _unary ( token . fn , this . unary ( ) ) ;
26122605 } else {
26132606 return this . primary ( ) ;
26142607 }
@@ -3001,13 +2994,13 @@ Scope.prototype = {
30012994 }
30022995 } ,
30032996
3004- validate : function ( expressionText , value ) {
2997+ validate : function ( expressionText , value , element ) {
30052998 var expression = Scope . expressionCache [ expressionText ] ;
30062999 if ( ! expression ) {
30073000 expression = new Parser ( expressionText ) . validator ( ) ;
30083001 Scope . expressionCache [ expressionText ] = expression ;
30093002 }
3010- var self = { scope :this } ;
3003+ var self = { scope :this , self : this . state , '$element' : element } ;
30113004 return expression ( self ) ( self , value ) ;
30123005 } ,
30133006
@@ -3485,7 +3478,7 @@ TextController.prototype = {
34853478 }
34863479 var errorText = isValidationError ? "Required Value" : null ;
34873480 if ( ! isValidationError && this . validator && value ) {
3488- errorText = scope . validate ( this . validator , value ) ;
3481+ errorText = scope . validate ( this . validator , value , view ) ;
34893482 isValidationError = ! ! errorText ;
34903483 }
34913484 if ( this . lastErrorText !== errorText ) {
@@ -3731,7 +3724,7 @@ BindUpdater.prototype = {
37313724 var part = parts [ i ] ;
37323725 var binding = Binder . binding ( part ) ;
37333726 if ( binding ) {
3734- scope . evalWidget ( this , binding , { element :this . view } , function ( value ) {
3727+ scope . evalWidget ( this , binding , { $ element :this . view } , function ( value ) {
37353728 html . push ( BindUpdater . toText ( value ) ) ;
37363729 } , function ( e , text ) {
37373730 setHtml ( this . view , text ) ;
@@ -3771,7 +3764,7 @@ BindAttrUpdater.prototype = {
37713764 var binding = Binder . binding ( attributeTemplate [ i ] ) ;
37723765 if ( binding ) {
37733766 try {
3774- var value = scope . eval ( binding , { element :jNode [ 0 ] , attrName :attrName } ) ;
3767+ var value = scope . eval ( binding , { $ element :jNode [ 0 ] , attrName :attrName } ) ;
37753768 if ( value && ( value . constructor !== array || value . length !== 0 ) )
37763769 attrValues . push ( value ) ;
37773770 } catch ( e ) {
0 commit comments