Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 3a954e1

Browse files
committed
fixup! feat($compile): add support for arbitrary property and event bindings
1 parent 58d4c16 commit 3a954e1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/ng/compile.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3479,7 +3479,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
34793479

34803480
var sanitizer = identity;
34813481
// Sanitize img[srcset] + source[srcset] values.
3482-
if ((nodeName === 'img' || nodeName === 'source') && propName === 'srcset') {
3482+
if (propName === 'srcset' && (nodeName === 'img' || nodeName === 'source')) {
34833483
sanitizer = sanitizeSrcsetPropertyValue;
34843484
} else if (trustedContext) {
34853485
sanitizer = $sce.getTrusted.bind($sce, trustedContext);
@@ -3526,7 +3526,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
35263526
if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {
35273527
throw $compileMinErr('nodomevents',
35283528
'Interpolations for HTML DOM event attributes are disallowed. Please use the ' +
3529-
'ng- versions (such as ng-click or ng-on-click instead of onclick) instead.');
3529+
'ng- versions (such as ng-click or ng-on-click rather than onclick) instead.');
35303530
}
35313531

35323532
directives.push({

test/ng/compileSpec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -12285,15 +12285,15 @@ describe('$compile', function() {
1228512285
expect(element.prop('test6')).toBe('Misko');
1228612286
}));
1228712287

12288-
it('should work indipendently of attributes with the same name', inject(function($rootScope, $compile) {
12288+
it('should work independently of attributes with the same name', inject(function($rootScope, $compile) {
1228912289
element = $compile('<span ng-prop-asdf="asdf" asdf="foo" />')($rootScope);
1229012290
$rootScope.asdf = 123;
1229112291
$rootScope.$digest();
1229212292
expect(element.prop('asdf')).toBe(123);
1229312293
expect(element.attr('asdf')).toBe('foo');
1229412294
}));
1229512295

12296-
it('should work indipendently of (ng-)attributes with the same name', inject(function($rootScope, $compile) {
12296+
it('should work independently of (ng-)attributes with the same name', inject(function($rootScope, $compile) {
1229712297
element = $compile('<span ng-prop-asdf="asdf" ng-attr-asdf="foo" />')($rootScope);
1229812298
$rootScope.asdf = 123;
1229912299
$rootScope.$digest();
@@ -12349,7 +12349,7 @@ describe('$compile', function() {
1234912349
});
1235012350
});
1235112351

12352-
it('should disallow property binding on onclick', inject(function($compile, $rootScope) {
12352+
it('should disallow property binding to onclick', inject(function($compile, $rootScope) {
1235312353
// All event prop bindings are disallowed.
1235412354
$rootScope.onClickJs = function() {};
1235512355
expect(function() {
@@ -12364,7 +12364,7 @@ describe('$compile', function() {
1236412364
'Please use the ng- versions (such as ng-click or ng-on-click instead of ng-prop-onclick) instead.');
1236512365
}));
1236612366

12367-
it('should process property binding in pre-linking phase at priority 100', function() {
12367+
it('should process property bindings at $watch time', function() {
1236812368
module(function() {
1236912369
directive('propLog', function(log) {
1237012370
return {

0 commit comments

Comments
 (0)