diff --git a/src/ng/compile.js b/src/ng/compile.js index 387d6a40..dd0ac00b 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -2355,7 +2355,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { compile: function() { return { pre: function attrInterpolatePreLinkFn(scope, element, attr) { - var $$observers = (attr.$$observers || (attr.$$observers = {})); + var $$observers = (attr.$$observers || (attr.$$observers = createMap())); if (EVENT_HANDLER_ATTR_REGEXP.test(name)) { throw $compileMinErr('nodomevents', diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 1e4717ad..909daaf6 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -3218,6 +3218,23 @@ describe('$compile', function() { }); }); + it('should be able to interpolate attribute names which are present in Object.prototype', function() { + var attrs; + module(function() { + directive('attrExposer', valueFn({ + link: function($scope, $element, $attrs) { + attrs = $attrs; + } + })); + }); + inject(function($compile, $rootScope) { + $compile('
')($rootScope); + $rootScope.$apply(); + expect(attrs.toString).toBe('2'); + expect(attrs.hasOwnProperty).toBe('2'); + }); + }); + describe('bind-once', function() {