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

Commit 582bc18

Browse files
committed
fixup! feat($compile): add support for arbitrary property and event bindings
1 parent f547b0d commit 582bc18

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/ng/compile.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
16001600
* @description
16011601
*
16021602
* Defines the security context for DOM properties bound by ng-prop-*
1603-
*
1603+
*
16041604
* @param {string} elementName The element name or '*' to match any element.
16051605
* @param {string} propertyName The DOM property name.
16061606
* @param {string} ctx The context in which this value is safe for use, e.g. $sce.URL,
@@ -1665,7 +1665,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
16651665
'link|href',
16661666
'media|src',
16671667
'object|codebase', 'object|data',
1668-
'script|src',
1668+
'script|src'
16691669
]);
16701670
})();
16711671

@@ -2380,7 +2380,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
23802380
//Update nName for cases where a prefix was removed
23812381
nName = directiveNormalize(name.toLowerCase());
23822382
attrsMap[nName] = name;
2383-
2383+
23842384
if (isNgAttr || !attrs.hasOwnProperty(nName)) {
23852385
attrs[nName] = value;
23862386
if (getBooleanAttrName(node, nName)) {
@@ -3461,7 +3461,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
34613461

34623462
function getTrustedPropContext(nodeName, propNormalizedName) {
34633463
var prop = propNormalizedName.toLowerCase();
3464-
return PROP_CONTEXTS[nodeName + "|" + prop] || PROP_CONTEXTS["*|" + prop];
3464+
return PROP_CONTEXTS[nodeName + '|' + prop] || PROP_CONTEXTS['*|' + prop];
34653465
}
34663466

34673467
function sanitizeSrcsetPropertyValue(value) {

test/ng/compileSpec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12055,7 +12055,7 @@ describe('$compile', function() {
1205512055
expect(attrs.ngAttrMyCameltitle).toBeUndefined();
1205612056
expect(attrs.$attr.ngAttrMyCameltitle).toBeUndefined();
1205712057
});
12058-
})
12058+
});
1205912059

1206012060
it('should work with the "href" attribute', inject(function() {
1206112061
$rootScope.value = 'test';
@@ -12143,19 +12143,19 @@ describe('$compile', function() {
1214312143
});
1214412144

1214512145
describe('ngOn* event binding', function() {
12146-
it("should add event listener of specified name", inject(function($compile, $rootScope) {
12146+
it('should add event listener of specified name', inject(function($compile, $rootScope) {
1214712147
$rootScope.name = 'Misko';
1214812148
element = $compile('<span ng-on-foo="name = name + 3"></span>')($rootScope);
1214912149
element.triggerHandler('foo');
1215012150
expect($rootScope.name).toBe('Misko3');
1215112151
}));
1215212152

12153-
it("should use angular.element(x).on() API to add listener", inject(function($compile, $rootScope) {
12153+
it('should use angular.element(x).on() API to add listener', inject(function($compile, $rootScope) {
1215412154
spyOn(angular.element.prototype, "on");
1215512155

1215612156
element = $compile('<span ng-on-foo="name = name + 3"></span>')($rootScope);
1215712157

12158-
expect(angular.element.prototype.on).toHaveBeenCalledWith("foo", jasmine.any(Function));
12158+
expect(angular.element.prototype.on).toHaveBeenCalledWith('foo', jasmine.any(Function));
1215912159
}));
1216012160

1216112161
it('should allow access to the $event object', inject(function($rootScope, $compile) {
@@ -12195,7 +12195,7 @@ describe('$compile', function() {
1219512195
});
1219612196

1219712197

12198-
describe("ngProp*", function() {
12198+
describe('ngProp*', function() {
1219912199
it('should bind boolean properties (input disabled)', inject(function($rootScope, $compile) {
1220012200
element = $compile('<button ng-prop-disabled="isDisabled">Button</button>')($rootScope);
1220112201
$rootScope.$digest();
@@ -12345,7 +12345,7 @@ describe('$compile', function() {
1234512345
$rootScope.$apply();
1234612346
expect(attrs.title).toBe('foo');
1234712347
expect(attrs.$attr.title).toBe('title');
12348-
expect(attrs.$attr.ngPropTitle).toBe("ng-prop-title");
12348+
expect(attrs.$attr.ngPropTitle).toBe('ng-prop-title');
1234912349
});
1235012350
});
1235112351

0 commit comments

Comments
 (0)