Skip to content

Commit 8826965

Browse files
committed
v1.3.0-rc.4
1 parent 824071f commit 8826965

File tree

2,372 files changed

+273669
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,372 files changed

+273669
-0
lines changed

1.3.0-rc.4/angular-1.3.0-rc.4.zip

8.61 MB
Binary file not shown.

1.3.0-rc.4/angular-animate.js

Lines changed: 1880 additions & 0 deletions
Large diffs are not rendered by default.

1.3.0-rc.4/angular-animate.min.js

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1.3.0-rc.4/angular-animate.min.js.map

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1.3.0-rc.4/angular-aria.js

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
/**
2+
* @license AngularJS v1.3.0-rc.4
3+
* (c) 2010-2014 Google, Inc. http://angularjs.org
4+
* License: MIT
5+
*/
6+
(function(window, angular, undefined) {'use strict';
7+
8+
/**
9+
* @ngdoc module
10+
* @name ngAria
11+
* @description
12+
*
13+
* The `ngAria` module provides support for adding aria tags that convey state or semantic information
14+
* about the application in order to allow assistive technologies to convey appropriate information to
15+
* persons with disabilities.
16+
*
17+
* <div doc-module-components="ngAria"></div>
18+
*
19+
* # Usage
20+
* To enable the addition of the aria tags, just require the module into your application and the tags will
21+
* hook into your ng-show/ng-hide, input, textarea, button, select and ng-required directives and adds the
22+
* appropriate aria-tags.
23+
*
24+
* Currently, the following aria tags are implemented:
25+
*
26+
* + aria-hidden
27+
* + aria-checked
28+
* + aria-disabled
29+
* + aria-required
30+
* + aria-invalid
31+
* + aria-multiline
32+
* + aria-valuenow
33+
* + aria-valuemin
34+
* + aria-valuemax
35+
* + tabindex
36+
*
37+
* You can disable individual aria tags by using the {@link ngAria.$ariaProvider#config config} method.
38+
*/
39+
40+
/* global -ngAriaModule */
41+
var ngAriaModule = angular.module('ngAria', ['ng']).
42+
provider('$aria', $AriaProvider);
43+
44+
/**
45+
* @ngdoc provider
46+
* @name $ariaProvider
47+
*
48+
* @description
49+
*
50+
* Used for configuring aria attributes.
51+
*
52+
* ## Dependencies
53+
* Requires the {@link ngAria} module to be installed.
54+
*/
55+
function $AriaProvider() {
56+
var config = {
57+
ariaHidden : true,
58+
ariaChecked: true,
59+
ariaDisabled: true,
60+
ariaRequired: true,
61+
ariaInvalid: true,
62+
ariaMultiline: true,
63+
ariaValue: true,
64+
tabindex: true
65+
};
66+
67+
/**
68+
* @ngdoc method
69+
* @name $ariaProvider#config
70+
*
71+
* @param {object} config object to enable/disable specific aria tags
72+
*
73+
* - **ariaHidden** – `{boolean}` – Enables/disables aria-hidden tags
74+
* - **ariaChecked** – `{boolean}` – Enables/disables aria-checked tags
75+
* - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags
76+
* - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags
77+
* - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags
78+
* - **ariaMultiline** – `{boolean}` – Enables/disables aria-multiline tags
79+
* - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and aria-valuenow tags
80+
* - **tabindex** – `{boolean}` – Enables/disables tabindex tags
81+
*
82+
* @description
83+
* Enables/disables various aria tags
84+
*/
85+
this.config = function(newConfig) {
86+
config = angular.extend(config, newConfig);
87+
};
88+
89+
function camelCase(input) {
90+
return input.replace(/-./g, function(letter, pos) {
91+
return letter[1].toUpperCase();
92+
});
93+
}
94+
95+
96+
function watchExpr(attrName, ariaAttr, negate) {
97+
var ariaCamelName = camelCase(ariaAttr);
98+
return function(scope, elem, attr) {
99+
if (config[ariaCamelName] && !attr[ariaCamelName]) {
100+
scope.$watch(attr[attrName], function(boolVal) {
101+
if (negate) {
102+
boolVal = !boolVal;
103+
}
104+
elem.attr(ariaAttr, boolVal);
105+
});
106+
}
107+
};
108+
}
109+
110+
/**
111+
* @ngdoc service
112+
* @name $aria
113+
*
114+
* @description
115+
*
116+
* Contains helper methods for applying aria tags to HTML
117+
*
118+
* ## Dependencies
119+
* Requires the {@link ngAria} module to be installed.
120+
*/
121+
this.$get = function() {
122+
return {
123+
config: function (key) {
124+
return config[camelCase(key)];
125+
},
126+
$$watchExpr: watchExpr
127+
};
128+
};
129+
}
130+
131+
var ngAriaTabindex = ['$aria', function($aria) {
132+
return function(scope, elem, attr) {
133+
if ($aria.config('tabindex') && !elem.attr('tabindex')) {
134+
elem.attr('tabindex', 0);
135+
}
136+
};
137+
}];
138+
139+
ngAriaModule.directive('ngShow', ['$aria', function($aria) {
140+
return $aria.$$watchExpr('ngShow', 'aria-hidden', true);
141+
}])
142+
.directive('ngHide', ['$aria', function($aria) {
143+
return $aria.$$watchExpr('ngHide', 'aria-hidden', false);
144+
}])
145+
.directive('ngModel', ['$aria', function($aria) {
146+
147+
function shouldAttachAttr (attr, elem) {
148+
return $aria.config(attr) && !elem.attr(attr);
149+
}
150+
151+
function getShape (attr, elem) {
152+
var type = attr.type,
153+
role = attr.role;
154+
155+
return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' :
156+
((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' :
157+
(type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' :
158+
(type || role) === 'textbox' || elem[0].nodeName === 'TEXTAREA' ? 'multiline' : '';
159+
}
160+
161+
return {
162+
restrict: 'A',
163+
require: '?ngModel',
164+
link: function(scope, elem, attr, ngModel) {
165+
var shape = getShape(attr, elem);
166+
var needsTabIndex = shouldAttachAttr('tabindex', elem);
167+
168+
function ngAriaWatchModelValue() {
169+
return ngModel.$modelValue;
170+
}
171+
172+
function getRadioReaction() {
173+
if (needsTabIndex) {
174+
needsTabIndex = false;
175+
return function ngAriaRadioReaction(newVal) {
176+
var boolVal = newVal === attr.value;
177+
elem.attr('aria-checked', boolVal);
178+
elem.attr('tabindex', 0 - !boolVal);
179+
};
180+
} else {
181+
return function ngAriaRadioReaction(newVal) {
182+
elem.attr('aria-checked', newVal === attr.value);
183+
};
184+
}
185+
}
186+
187+
function ngAriaCheckboxReaction(newVal) {
188+
elem.attr('aria-checked', !!newVal);
189+
}
190+
191+
switch (shape) {
192+
case 'radio':
193+
case 'checkbox':
194+
if (shouldAttachAttr('aria-checked', elem)) {
195+
scope.$watch(ngAriaWatchModelValue, shape === 'radio' ?
196+
getRadioReaction() : ngAriaCheckboxReaction);
197+
}
198+
break;
199+
case 'range':
200+
if ($aria.config('ariaValue')) {
201+
if (attr.min && !elem.attr('aria-valuemin')) {
202+
elem.attr('aria-valuemin', attr.min);
203+
}
204+
if (attr.max && !elem.attr('aria-valuemax')) {
205+
elem.attr('aria-valuemax', attr.max);
206+
}
207+
if (!elem.attr('aria-valuenow')) {
208+
scope.$watch(ngAriaWatchModelValue, function ngAriaValueNowReaction(newVal) {
209+
elem.attr('aria-valuenow', newVal);
210+
});
211+
}
212+
}
213+
break;
214+
case 'multiline':
215+
if (shouldAttachAttr('aria-multiline', elem)) {
216+
elem.attr('aria-multiline', true);
217+
}
218+
break;
219+
}
220+
221+
if (needsTabIndex) {
222+
elem.attr('tabindex', 0);
223+
}
224+
225+
if (ngModel.$validators.required && shouldAttachAttr('aria-required', elem)) {
226+
scope.$watch(function ngAriaRequiredWatch() {
227+
return ngModel.$error.required;
228+
}, function ngAriaRequiredReaction(newVal) {
229+
elem.attr('aria-required', !!newVal);
230+
});
231+
}
232+
233+
if (shouldAttachAttr('aria-invalid', elem)) {
234+
scope.$watch(function ngAriaInvalidWatch() {
235+
return ngModel.$invalid;
236+
}, function ngAriaInvalidReaction(newVal) {
237+
elem.attr('aria-invalid', !!newVal);
238+
});
239+
}
240+
}
241+
};
242+
}])
243+
.directive('ngDisabled', ['$aria', function($aria) {
244+
return $aria.$$watchExpr('ngDisabled', 'aria-disabled');
245+
}])
246+
.directive('ngClick', ngAriaTabindex)
247+
.directive('ngDblclick', ngAriaTabindex);
248+
249+
250+
})(window, window.angular);

0 commit comments

Comments
 (0)