This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 3 files changed +7
-3
lines changed
3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,11 @@ forEach({
92
92
CONSTANTS [ name ] = constantGetter ;
93
93
} ) ;
94
94
95
+ //Not quite a constant, but can be lex/parsed the same
96
+ CONSTANTS [ 'this' ] = function ( self ) { return self ; } ;
97
+ CONSTANTS [ 'this' ] . sharedGetter = true ;
98
+
99
+
95
100
//Operators - will be wrapped by binaryFn/unaryFn/assignment/filter
96
101
var OPERATORS = extend ( createMap ( ) , {
97
102
/* jshint bitwise : false */
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ function $RootScopeProvider(){
128
128
this . $$phase = this . $parent = this . $$watchers =
129
129
this . $$nextSibling = this . $$prevSibling =
130
130
this . $$childHead = this . $$childTail = null ;
131
- this [ 'this' ] = this . $root = this ;
131
+ this . $root = this ;
132
132
this . $$destroyed = false ;
133
133
this . $$asyncQueue = [ ] ;
134
134
this . $$postDigestQueue = [ ] ;
@@ -212,7 +212,6 @@ function $RootScopeProvider(){
212
212
}
213
213
child = new this . $$ChildScope ( ) ;
214
214
}
215
- child [ 'this' ] = child ;
216
215
child . $parent = this ;
217
216
child . $$prevSibling = this . $$childTail ;
218
217
if ( this . $$childHead ) {
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ describe('Scope', function() {
52
52
53
53
describe ( 'this' , function ( ) {
54
54
it ( 'should have a \'this\'' , inject ( function ( $rootScope ) {
55
- expect ( $rootScope [ 'this' ] ) . toEqual ( $rootScope ) ;
55
+ expect ( $rootScope . $eval ( 'this' ) ) . toEqual ( $rootScope ) ;
56
56
} ) ) ;
57
57
} ) ;
58
58
You can’t perform that action at this time.
0 commit comments