@@ -109,16 +109,9 @@ function $AriaProvider() {
109109 config = angular . extend ( config , newConfig ) ;
110110 } ;
111111
112- function camelCase ( input ) {
113- return input . replace ( / - ./ g, function ( letter , pos ) {
114- return letter [ 1 ] . toUpperCase ( ) ;
115- } ) ;
116- }
117-
118-
119112 function watchExpr ( attrName , ariaAttr , negate ) {
120- var ariaCamelName = camelCase ( ariaAttr ) ;
121113 return function ( scope , elem , attr ) {
114+ var ariaCamelName = attr . $normalize ( ariaAttr ) ;
122115 if ( config [ ariaCamelName ] && ! attr [ ariaCamelName ] ) {
123116 scope . $watch ( attr [ attrName ] , function ( boolVal ) {
124117 if ( negate ) {
@@ -178,7 +171,7 @@ function $AriaProvider() {
178171 this . $get = function ( ) {
179172 return {
180173 config : function ( key ) {
181- return config [ camelCase ( key ) ] ;
174+ return config [ key ] ;
182175 } ,
183176 $$watchExpr : watchExpr
184177 } ;
@@ -194,8 +187,8 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
194187} ] )
195188. directive ( 'ngModel' , [ '$aria' , function ( $aria ) {
196189
197- function shouldAttachAttr ( attr , elem ) {
198- return $aria . config ( attr ) && ! elem . attr ( attr ) ;
190+ function shouldAttachAttr ( attr , normalizedAttr , elem ) {
191+ return $aria . config ( normalizedAttr ) && ! elem . attr ( attr ) ;
199192 }
200193
201194 function getShape ( attr , elem ) {
@@ -213,7 +206,7 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
213206 require : '?ngModel' ,
214207 link : function ( scope , elem , attr , ngModel ) {
215208 var shape = getShape ( attr , elem ) ;
216- var needsTabIndex = shouldAttachAttr ( 'tabindex' , elem ) ;
209+ var needsTabIndex = shouldAttachAttr ( 'tabindex' , 'tabindex' , elem ) ;
217210
218211 function ngAriaWatchModelValue ( ) {
219212 return ngModel . $modelValue ;
@@ -241,7 +234,7 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
241234 switch ( shape ) {
242235 case 'radio' :
243236 case 'checkbox' :
244- if ( shouldAttachAttr ( 'aria-checked' , elem ) ) {
237+ if ( shouldAttachAttr ( 'aria-checked' , 'ariaChecked' , elem ) ) {
245238 scope . $watch ( ngAriaWatchModelValue , shape === 'radio' ?
246239 getRadioReaction ( ) : ngAriaCheckboxReaction ) ;
247240 }
@@ -262,7 +255,7 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
262255 }
263256 break ;
264257 case 'multiline' :
265- if ( shouldAttachAttr ( 'aria-multiline' , elem ) ) {
258+ if ( shouldAttachAttr ( 'aria-multiline' , 'ariaMultiline' , elem ) ) {
266259 elem . attr ( 'aria-multiline' , true ) ;
267260 }
268261 break ;
@@ -272,15 +265,15 @@ ngAriaModule.directive('ngShow', ['$aria', function($aria) {
272265 elem . attr ( 'tabindex' , 0 ) ;
273266 }
274267
275- if ( ngModel . $validators . required && shouldAttachAttr ( 'aria-required' , elem ) ) {
268+ if ( ngModel . $validators . required && shouldAttachAttr ( 'aria-required' , 'ariaRequired' , elem ) ) {
276269 scope . $watch ( function ngAriaRequiredWatch ( ) {
277270 return ngModel . $error . required ;
278271 } , function ngAriaRequiredReaction ( newVal ) {
279272 elem . attr ( 'aria-required' , ! ! newVal ) ;
280273 } ) ;
281274 }
282275
283- if ( shouldAttachAttr ( 'aria-invalid' , elem ) ) {
276+ if ( shouldAttachAttr ( 'aria-invalid' , 'ariaInvalid' , elem ) ) {
284277 scope . $watch ( function ngAriaInvalidWatch ( ) {
285278 return ngModel . $invalid ;
286279 } , function ngAriaInvalidReaction ( newVal ) {
0 commit comments