Skip to content

Commit 4f7a3b7

Browse files
Merge pull request #120 from angular/master
Views should be disposed when not visible
2 parents 07aef32 + 736e299 commit 4f7a3b7

File tree

8 files changed

+52
-17
lines changed

8 files changed

+52
-17
lines changed

docs/config/templates/ngdoc/lib/methods.template.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ <h4>Parameters</h4>
1717
{% endif %}
1818

1919
{% if method.this %}
20-
<h4>Method's {% code %}this{% endcode %}</h4>
20+
<h4>Method's `this`</h4>
2121
{$ method.this | marked $}
2222
{% endif %}
2323

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{% if doc.this %}
2-
<h3>Method's {% code %}this{% endcode %}</h3>
2+
<h3>Method's `this`</h3>
33
{$ doc.this | marked $}
4-
{% endif %}
4+
{% endif %}

i18n/ucd/src/extract.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function main() {
2020
} catch (e) {
2121
fs.mkdirSync(__dirname + '/../../../src/ngParseExt');
2222
}
23-
fs.writeFile(__dirname + '/../../../src/ngParseExt/ucd.js', code);
23+
fs.writeFileSync(__dirname + '/../../../src/ngParseExt/ucd.js', code);
2424
}
2525
}
2626

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@
9999
"stringmap": "^0.2.2"
100100
},
101101
"dependencies": {},
102+
"resolutions": {
103+
"//1": "`[email protected]` does not work with Node.js 10.x on Windows 10",
104+
"//2": "(E.g. see https://github.com/gulpjs/gulp/issues/2162.)",
105+
"natives": "1.1.3"
106+
},
102107
"commitplease": {
103108
"style": "angular",
104109
"nohook": true

test/ng/compileSpec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -11703,37 +11703,37 @@ describe('$compile', function() {
1170311703
// All interpolations are disallowed.
1170411704
$rootScope.onClickJs = '';
1170511705
expect(function() {
11706-
$compile('<button onclick="{{onClickJs}}"></script>');
11706+
$compile('<button onclick="{{onClickJs}}"></button>');
1170711707
}).toThrowMinErr(
1170811708
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
1170911709
expect(function() {
11710-
$compile('<button ONCLICK="{{onClickJs}}"></script>');
11710+
$compile('<button ONCLICK="{{onClickJs}}"></button>');
1171111711
}).toThrowMinErr(
1171211712
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
1171311713
expect(function() {
11714-
$compile('<button ng-attr-onclick="{{onClickJs}}"></script>');
11714+
$compile('<button ng-attr-onclick="{{onClickJs}}"></button>');
1171511715
}).toThrowMinErr(
1171611716
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
1171711717
expect(function() {
11718-
$compile('<button ng-attr-ONCLICK="{{onClickJs}}"></script>');
11718+
$compile('<button ng-attr-ONCLICK="{{onClickJs}}"></button>');
1171911719
}).toThrowMinErr(
1172011720
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
1172111721
}));
1172211722

1172311723
it('should pass through arbitrary values on onXYZ event attributes that contain a hyphen', inject(function($compile, $rootScope) {
11724-
element = $compile('<button on-click="{{onClickJs}}"></script>')($rootScope);
11724+
element = $compile('<button on-click="{{onClickJs}}"></button>')($rootScope);
1172511725
$rootScope.onClickJs = 'javascript:doSomething()';
1172611726
$rootScope.$apply();
1172711727
expect(element.attr('on-click')).toEqual('javascript:doSomething()');
1172811728
}));
1172911729

1173011730
it('should pass through arbitrary values on "on" and "data-on" attributes', inject(function($compile, $rootScope) {
11731-
element = $compile('<button data-on="{{dataOnVar}}"></script>')($rootScope);
11731+
element = $compile('<button data-on="{{dataOnVar}}"></button>')($rootScope);
1173211732
$rootScope.dataOnVar = 'data-on text';
1173311733
$rootScope.$apply();
1173411734
expect(element.attr('data-on')).toEqual('data-on text');
1173511735

11736-
element = $compile('<button on="{{onVar}}"></script>')($rootScope);
11736+
element = $compile('<button on="{{onVar}}"></button>')($rootScope);
1173711737
$rootScope.onVar = 'on text';
1173811738
$rootScope.$apply();
1173911739
expect(element.attr('on')).toEqual('on text');

test/ng/ngOnSpec.js

+30
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,34 @@ describe('ngOn* event binding', function() {
155155
expect(attrs.$attr.ngOnTitle).toBe('ng-on-title');
156156
});
157157
});
158+
159+
it('should correctly bind to kebab-cased event names', inject(function($compile, $rootScope) {
160+
var element = $compile('<span ng-on-foo-bar="cb()"></span>')($rootScope);
161+
var cb = $rootScope.cb = jasmine.createSpy('ng-on cb');
162+
$rootScope.$digest();
163+
164+
element.triggerHandler('foobar');
165+
element.triggerHandler('fooBar');
166+
element.triggerHandler('foo_bar');
167+
element.triggerHandler('foo:bar');
168+
expect(cb).not.toHaveBeenCalled();
169+
170+
element.triggerHandler('foo-bar');
171+
expect(cb).toHaveBeenCalled();
172+
}));
173+
174+
it('should correctly bind to camelCased event names', inject(function($compile, $rootScope) {
175+
var element = $compile('<span ng-on-foo_bar="cb()"></span>')($rootScope);
176+
var cb = $rootScope.cb = jasmine.createSpy('ng-on cb');
177+
$rootScope.$digest();
178+
179+
element.triggerHandler('foobar');
180+
element.triggerHandler('foo-bar');
181+
element.triggerHandler('foo_bar');
182+
element.triggerHandler('foo:bar');
183+
expect(cb).not.toHaveBeenCalled();
184+
185+
element.triggerHandler('fooBar');
186+
expect(cb).toHaveBeenCalled();
187+
}));
158188
});

test/ng/ngPropSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ describe('ngProp*', function() {
147147
it('should disallow property binding to onclick', inject(function($compile, $rootScope) {
148148
// All event prop bindings are disallowed.
149149
expect(function() {
150-
$compile('<button ng-prop-onclick="onClickJs"></script>');
150+
$compile('<button ng-prop-onclick="onClickJs"></button>');
151151
}).toThrowMinErr(
152152
'$compile', 'nodomevents', 'Property bindings for HTML DOM event properties are disallowed');
153153
expect(function() {
154-
$compile('<button ng-prop-ONCLICK="onClickJs"></script>');
154+
$compile('<button ng-prop-ONCLICK="onClickJs"></button>');
155155
}).toThrowMinErr(
156156
'$compile', 'nodomevents', 'Property bindings for HTML DOM event properties are disallowed');
157157
}));

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -5750,10 +5750,10 @@ nanomatch@^1.2.9:
57505750
snapdragon "^0.8.1"
57515751
to-regex "^3.0.1"
57525752

5753-
natives@^1.1.0:
5754-
version "1.1.0"
5755-
resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.0.tgz#e9ff841418a6b2ec7a495e939984f78f163e6e31"
5756-
integrity sha1-6f+EFBimsux6SV6TmYT3jxY+bjE=
5753+
natives@1.1.3, natives@^1.1.0:
5754+
version "1.1.3"
5755+
resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.3.tgz#44a579be64507ea2d6ed1ca04a9415915cf75558"
5756+
integrity sha512-BZGSYV4YOLxzoTK73l0/s/0sH9l8SHs2ocReMH1f8JYSh5FUWu4ZrKCpJdRkWXV6HFR/pZDz7bwWOVAY07q77g==
57575757

57585758
natural-compare@^1.4.0:
57595759
version "1.4.0"

0 commit comments

Comments
 (0)