Skip to content

Views should be disposed when not visible #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/config/templates/ngdoc/lib/methods.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h4>Parameters</h4>
{% endif %}

{% if method.this %}
<h4>Method's {% code %}this{% endcode %}</h4>
<h4>Method's `this`</h4>
{$ method.this | marked $}
{% endif %}

Expand Down
4 changes: 2 additions & 2 deletions docs/config/templates/ngdoc/lib/this.template.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if doc.this %}
<h3>Method's {% code %}this{% endcode %}</h3>
<h3>Method's `this`</h3>
{$ doc.this | marked $}
{% endif %}
{% endif %}
2 changes: 1 addition & 1 deletion i18n/ucd/src/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function main() {
} catch (e) {
fs.mkdirSync(__dirname + '/../../../src/ngParseExt');
}
fs.writeFile(__dirname + '/../../../src/ngParseExt/ucd.js', code);
fs.writeFileSync(__dirname + '/../../../src/ngParseExt/ucd.js', code);
}
}

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@
"stringmap": "^0.2.2"
},
"dependencies": {},
"resolutions": {
"//1": "`natives@1.1.0` does not work with Node.js 10.x on Windows 10",
"//2": "(E.g. see https://github.com/gulpjs/gulp/issues/2162.)",
"natives": "1.1.3"
},
"commitplease": {
"style": "angular",
"nohook": true
Expand Down
14 changes: 7 additions & 7 deletions test/ng/compileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11703,37 +11703,37 @@ describe('$compile', function() {
// All interpolations are disallowed.
$rootScope.onClickJs = '';
expect(function() {
$compile('<button onclick="{{onClickJs}}"></script>');
$compile('<button onclick="{{onClickJs}}"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
expect(function() {
$compile('<button ONCLICK="{{onClickJs}}"></script>');
$compile('<button ONCLICK="{{onClickJs}}"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
expect(function() {
$compile('<button ng-attr-onclick="{{onClickJs}}"></script>');
$compile('<button ng-attr-onclick="{{onClickJs}}"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
expect(function() {
$compile('<button ng-attr-ONCLICK="{{onClickJs}}"></script>');
$compile('<button ng-attr-ONCLICK="{{onClickJs}}"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Interpolations for HTML DOM event attributes are disallowed');
}));

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

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

element = $compile('<button on="{{onVar}}"></script>')($rootScope);
element = $compile('<button on="{{onVar}}"></button>')($rootScope);
$rootScope.onVar = 'on text';
$rootScope.$apply();
expect(element.attr('on')).toEqual('on text');
Expand Down
30 changes: 30 additions & 0 deletions test/ng/ngOnSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,34 @@ describe('ngOn* event binding', function() {
expect(attrs.$attr.ngOnTitle).toBe('ng-on-title');
});
});

it('should correctly bind to kebab-cased event names', inject(function($compile, $rootScope) {
var element = $compile('<span ng-on-foo-bar="cb()"></span>')($rootScope);
var cb = $rootScope.cb = jasmine.createSpy('ng-on cb');
$rootScope.$digest();

element.triggerHandler('foobar');
element.triggerHandler('fooBar');
element.triggerHandler('foo_bar');
element.triggerHandler('foo:bar');
expect(cb).not.toHaveBeenCalled();

element.triggerHandler('foo-bar');
expect(cb).toHaveBeenCalled();
}));

it('should correctly bind to camelCased event names', inject(function($compile, $rootScope) {
var element = $compile('<span ng-on-foo_bar="cb()"></span>')($rootScope);
var cb = $rootScope.cb = jasmine.createSpy('ng-on cb');
$rootScope.$digest();

element.triggerHandler('foobar');
element.triggerHandler('foo-bar');
element.triggerHandler('foo_bar');
element.triggerHandler('foo:bar');
expect(cb).not.toHaveBeenCalled();

element.triggerHandler('fooBar');
expect(cb).toHaveBeenCalled();
}));
});
4 changes: 2 additions & 2 deletions test/ng/ngPropSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ describe('ngProp*', function() {
it('should disallow property binding to onclick', inject(function($compile, $rootScope) {
// All event prop bindings are disallowed.
expect(function() {
$compile('<button ng-prop-onclick="onClickJs"></script>');
$compile('<button ng-prop-onclick="onClickJs"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Property bindings for HTML DOM event properties are disallowed');
expect(function() {
$compile('<button ng-prop-ONCLICK="onClickJs"></script>');
$compile('<button ng-prop-ONCLICK="onClickJs"></button>');
}).toThrowMinErr(
'$compile', 'nodomevents', 'Property bindings for HTML DOM event properties are disallowed');
}));
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5750,10 +5750,10 @@ nanomatch@^1.2.9:
snapdragon "^0.8.1"
to-regex "^3.0.1"

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

natural-compare@^1.4.0:
version "1.4.0"
Expand Down