diff options
| -rw-r--r-- | src/ng/compile.js | 2 | ||||
| -rwxr-xr-x | test/ng/compileSpec.js | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/ng/compile.js b/src/ng/compile.js index 040836f7..2aec8fcd 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -159,7 +159,7 @@ function $CompileProvider($provide) { // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes // The assumption is that future DOM event attribute names will begin with // 'on' and be composed of only English letters. - var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]*|formaction)$/; + var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/; /** * @ngdoc function diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 580d51c3..6b3a0479 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -3250,6 +3250,18 @@ describe('$compile', function() { $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); + $rootScope.dataOnVar = 'data-on text'; + $rootScope.$apply(); + expect(element.attr('data-on')).toEqual('data-on text'); + + element = $compile('<button on="{{onVar}}"></script>')($rootScope); + $rootScope.onVar = 'on text'; + $rootScope.$apply(); + expect(element.attr('on')).toEqual('on text'); + })); }); describe('iframe[src]', function() { |
