14 lines
3.4 KiB
JavaScript
14 lines
3.4 KiB
JavaScript
/*
|
|
AngularJS v1.3.20
|
|
(c) 2010-2014 Google, Inc. http://angularjs.org
|
|
License: MIT
|
|
*/
|
|
(function(q,p,r){'use strict';p.module("ngAria",["ng"]).provider("$aria",function(){function a(a,f,k){return function(l,d,e){var b=e.$normalize(f);c[b]&&!e[b]&&l.$watch(e[a],function(b){k&&(b=!b);d.attr(f,b)})}}var c={ariaHidden:!0,ariaChecked:!0,ariaDisabled:!0,ariaRequired:!0,ariaInvalid:!0,ariaMultiline:!0,ariaValue:!0,tabindex:!0,bindKeypress:!0};this.config=function(a){c=p.extend(c,a)};this.$get=function(){return{config:function(a){return c[a]},$$watchExpr:a}}}).directive("ngShow",["$aria",function(a){return a.$$watchExpr("ngShow",
|
|
"aria-hidden",!0)}]).directive("ngHide",["$aria",function(a){return a.$$watchExpr("ngHide","aria-hidden",!1)}]).directive("ngModel",["$aria",function(a){function c(c,l,d){return a.config(l)&&!d.attr(c)}function h(a,c){return!c.attr("role")&&c.attr("type")===a&&"INPUT"!==c[0].nodeName}function f(a,c){var d=a.type,e=a.role;return"checkbox"===(d||e)||"menuitemcheckbox"===e?"checkbox":"radio"===(d||e)||"menuitemradio"===e?"radio":"range"===d||"progressbar"===e||"slider"===e?"range":"textbox"===(d||e)||
|
|
"TEXTAREA"===c[0].nodeName?"multiline":""}return{restrict:"A",require:"?ngModel",priority:200,compile:function(k,l){var d=f(l,k);return{pre:function(a,b,c,g){"checkbox"===d&&"checkbox"!==c.type&&(g.$isEmpty=function(b){return!1===b})},post:function(e,b,m,g){function f(){return g.$modelValue}function l(){return n?(n=!1,function(a){a=m.value==g.$viewValue;b.attr("aria-checked",a);b.attr("tabindex",0-!a)}):function(a){b.attr("aria-checked",m.value==g.$viewValue)}}function k(){b.attr("aria-checked",!g.$isEmpty(g.$viewValue))}
|
|
var n=c("tabindex","tabindex",b);switch(d){case "radio":case "checkbox":h(d,b)&&b.attr("role",d);c("aria-checked","ariaChecked",b)&&e.$watch(f,"radio"===d?l():k);break;case "range":h(d,b)&&b.attr("role","slider");a.config("ariaValue")&&(m.min&&!b.attr("aria-valuemin")&&b.attr("aria-valuemin",m.min),m.max&&!b.attr("aria-valuemax")&&b.attr("aria-valuemax",m.max),b.attr("aria-valuenow")||e.$watch(f,function(a){b.attr("aria-valuenow",a)}));break;case "multiline":c("aria-multiline","ariaMultiline",b)&&
|
|
b.attr("aria-multiline",!0)}n&&b.attr("tabindex",0);g.$validators.required&&c("aria-required","ariaRequired",b)&&e.$watch(function(){return g.$error.required},function(a){b.attr("aria-required",!!a)});c("aria-invalid","ariaInvalid",b)&&e.$watch(function(){return g.$invalid},function(a){b.attr("aria-invalid",!!a)})}}}}}]).directive("ngDisabled",["$aria",function(a){return a.$$watchExpr("ngDisabled","aria-disabled")}]).directive("ngMessages",function(){return{restrict:"A",require:"?ngMessages",link:function(a,
|
|
c,h,f){c.attr("aria-live")||c.attr("aria-live","assertive")}}}).directive("ngClick",["$aria","$parse",function(a,c){return{restrict:"A",compile:function(h,f){var k=c(f.ngClick,null,!0);return function(c,d,e){function b(a,b){if(-1!==b.indexOf(a[0].nodeName))return!0}var f=["BUTTON","A","INPUT","TEXTAREA"];d.attr("role")||b(d,f)||d.attr("role","button");a.config("tabindex")&&!d.attr("tabindex")&&d.attr("tabindex",0);if(a.config("bindKeypress")&&!e.ngKeypress&&!b(d,f))d.on("keypress",function(a){function b(){k(c,
|
|
{$event:a})}32!==a.keyCode&&13!==a.keyCode||c.$apply(b)})}}}}]).directive("ngDblclick",["$aria",function(a){return function(c,h,f){a.config("tabindex")&&!h.attr("tabindex")&&h.attr("tabindex",0)}}])})(window,window.angular);
|
|
//# sourceMappingURL=angular-aria.min.js.map
|