Skip to content

Commit ac7918b

Browse files
committed
v1.4.4
1 parent d691aad commit ac7918b

File tree

2,503 files changed

+305722
-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,503 files changed

+305722
-0
lines changed

1.4.4/angular-1.4.4.zip

9.34 MB
Binary file not shown.

1.4.4/angular-animate.js

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

1.4.4/angular-animate.min.js

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

1.4.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.4.4/angular-aria.js

Lines changed: 393 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,393 @@
1+
/**
2+
* @license AngularJS v1.4.4
3+
* (c) 2010-2015 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 common
14+
* [<abbr title="Accessible Rich Internet Applications">ARIA</abbr>](http://www.w3.org/TR/wai-aria/)
15+
* attributes that convey state or semantic information about the application for users
16+
* of assistive technologies, such as screen readers.
17+
*
18+
* <div doc-module-components="ngAria"></div>
19+
*
20+
* ## Usage
21+
*
22+
* For ngAria to do its magic, simply include the module `ngAria` as a dependency. The following
23+
* directives are supported:
24+
* `ngModel`, `ngDisabled`, `ngShow`, `ngHide`, `ngClick`, `ngDblClick`, and `ngMessages`.
25+
*
26+
* Below is a more detailed breakdown of the attributes handled by ngAria:
27+
*
28+
* | Directive | Supported Attributes |
29+
* |---------------------------------------------|----------------------------------------------------------------------------------------|
30+
* | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled |
31+
* | {@link ng.directive:ngShow ngShow} | aria-hidden |
32+
* | {@link ng.directive:ngHide ngHide} | aria-hidden |
33+
* | {@link ng.directive:ngDblclick ngDblclick} | tabindex |
34+
* | {@link module:ngMessages ngMessages} | aria-live |
35+
* | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles |
36+
* | {@link ng.directive:ngClick ngClick} | tabindex, keypress event, button role |
37+
*
38+
* Find out more information about each directive by reading the
39+
* {@link guide/accessibility ngAria Developer Guide}.
40+
*
41+
* ##Example
42+
* Using ngDisabled with ngAria:
43+
* ```html
44+
* <md-checkbox ng-disabled="disabled">
45+
* ```
46+
* Becomes:
47+
* ```html
48+
* <md-checkbox ng-disabled="disabled" aria-disabled="true">
49+
* ```
50+
*
51+
* ##Disabling Attributes
52+
* It's possible to disable individual attributes added by ngAria with the
53+
* {@link ngAria.$ariaProvider#config config} method. For more details, see the
54+
* {@link guide/accessibility Developer Guide}.
55+
*/
56+
/* global -ngAriaModule */
57+
var ngAriaModule = angular.module('ngAria', ['ng']).
58+
provider('$aria', $AriaProvider);
59+
60+
/**
61+
* @ngdoc provider
62+
* @name $ariaProvider
63+
*
64+
* @description
65+
*
66+
* Used for configuring the ARIA attributes injected and managed by ngAria.
67+
*
68+
* ```js
69+
* angular.module('myApp', ['ngAria'], function config($ariaProvider) {
70+
* $ariaProvider.config({
71+
* ariaValue: true,
72+
* tabindex: false
73+
* });
74+
* });
75+
*```
76+
*
77+
* ## Dependencies
78+
* Requires the {@link ngAria} module to be installed.
79+
*
80+
*/
81+
function $AriaProvider() {
82+
var config = {
83+
ariaHidden: true,
84+
ariaChecked: true,
85+
ariaDisabled: true,
86+
ariaRequired: true,
87+
ariaInvalid: true,
88+
ariaMultiline: true,
89+
ariaValue: true,
90+
tabindex: true,
91+
bindKeypress: true,
92+
bindRoleForClick: true
93+
};
94+
95+
/**
96+
* @ngdoc method
97+
* @name $ariaProvider#config
98+
*
99+
* @param {object} config object to enable/disable specific ARIA attributes
100+
*
101+
* - **ariaHidden** – `{boolean}` – Enables/disables aria-hidden tags
102+
* - **ariaChecked** – `{boolean}` – Enables/disables aria-checked tags
103+
* - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags
104+
* - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags
105+
* - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags
106+
* - **ariaMultiline** – `{boolean}` – Enables/disables aria-multiline tags
107+
* - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and aria-valuenow tags
108+
* - **tabindex** – `{boolean}` – Enables/disables tabindex tags
109+
* - **bindKeypress** – `{boolean}` – Enables/disables keypress event binding on `&lt;div&gt;` and
110+
* `&lt;li&gt;` elements with ng-click
111+
* - **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements like `div`
112+
* using ng-click, making them more accessible to users of assistive technologies
113+
*
114+
* @description
115+
* Enables/disables various ARIA attributes
116+
*/
117+
this.config = function(newConfig) {
118+
config = angular.extend(config, newConfig);
119+
};
120+
121+
function watchExpr(attrName, ariaAttr, negate) {
122+
return function(scope, elem, attr) {
123+
var ariaCamelName = attr.$normalize(ariaAttr);
124+
if (config[ariaCamelName] && !attr[ariaCamelName]) {
125+
scope.$watch(attr[attrName], function(boolVal) {
126+
// ensure boolean value
127+
boolVal = negate ? !boolVal : !!boolVal;
128+
elem.attr(ariaAttr, boolVal);
129+
});
130+
}
131+
};
132+
}
133+
134+
/**
135+
* @ngdoc service
136+
* @name $aria
137+
*
138+
* @description
139+
* @priority 200
140+
*
141+
* The $aria service contains helper methods for applying common
142+
* [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
143+
*
144+
* ngAria injects common accessibility attributes that tell assistive technologies when HTML
145+
* elements are enabled, selected, hidden, and more. To see how this is performed with ngAria,
146+
* let's review a code snippet from ngAria itself:
147+
*
148+
*```js
149+
* ngAriaModule.directive('ngDisabled', ['$aria', function($aria) {
150+
* return $aria.$$watchExpr('ngDisabled', 'aria-disabled');
151+
* }])
152+
*```
153+
* Shown above, the ngAria module creates a directive with the same signature as the
154+
* traditional `ng-disabled` directive. But this ngAria version is dedicated to
155+
* solely managing accessibility attributes. The internal `$aria` service is used to watch the
156+
* boolean attribute `ngDisabled`. If it has not been explicitly set by the developer,
157+
* `aria-disabled` is injected as an attribute with its value synchronized to the value in
158+
* `ngDisabled`.
159+
*
160+
* Because ngAria hooks into the `ng-disabled` directive, developers do not have to do
161+
* anything to enable this feature. The `aria-disabled` attribute is automatically managed
162+
* simply as a silent side-effect of using `ng-disabled` with the ngAria module.
163+
*
164+
* The full list of directives that interface with ngAria:
165+
* * **ngModel**
166+
* * **ngShow**
167+
* * **ngHide**
168+
* * **ngClick**
169+
* * **ngDblclick**
170+
* * **ngMessages**
171+
* * **ngDisabled**
172+
*
173+
* Read the {@link guide/accessibility ngAria Developer Guide} for a thorough explanation of each
174+
* directive.
175+
*
176+
*
177+
* ## Dependencies
178+
* Requires the {@link ngAria} module to be installed.
179+
*/
180+
this.$get = function() {
181+
return {
182+
config: function(key) {
183+
return config[key];
184+
},
185+
$$watchExpr: watchExpr
186+
};
187+
};
188+
}
189+
190+
191+
ngAriaModule.directive('ngShow', ['$aria', function($aria) {
192+
return $aria.$$watchExpr('ngShow', 'aria-hidden', true);
193+
}])
194+
.directive('ngHide', ['$aria', function($aria) {
195+
return $aria.$$watchExpr('ngHide', 'aria-hidden', false);
196+
}])
197+
.directive('ngModel', ['$aria', function($aria) {
198+
199+
function shouldAttachAttr(attr, normalizedAttr, elem) {
200+
return $aria.config(normalizedAttr) && !elem.attr(attr);
201+
}
202+
203+
function shouldAttachRole(role, elem) {
204+
return !elem.attr('role') && (elem.attr('type') === role) && (elem[0].nodeName !== 'INPUT');
205+
}
206+
207+
function getShape(attr, elem) {
208+
var type = attr.type,
209+
role = attr.role;
210+
211+
return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' :
212+
((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' :
213+
(type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' :
214+
(type || role) === 'textbox' || elem[0].nodeName === 'TEXTAREA' ? 'multiline' : '';
215+
}
216+
217+
return {
218+
restrict: 'A',
219+
require: '?ngModel',
220+
priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value
221+
compile: function(elem, attr) {
222+
var shape = getShape(attr, elem);
223+
224+
return {
225+
pre: function(scope, elem, attr, ngModel) {
226+
if (shape === 'checkbox' && attr.type !== 'checkbox') {
227+
//Use the input[checkbox] $isEmpty implementation for elements with checkbox roles
228+
ngModel.$isEmpty = function(value) {
229+
return value === false;
230+
};
231+
}
232+
},
233+
post: function(scope, elem, attr, ngModel) {
234+
var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem);
235+
236+
function ngAriaWatchModelValue() {
237+
return ngModel.$modelValue;
238+
}
239+
240+
function getRadioReaction() {
241+
if (needsTabIndex) {
242+
needsTabIndex = false;
243+
return function ngAriaRadioReaction(newVal) {
244+
var boolVal = (attr.value == ngModel.$viewValue);
245+
elem.attr('aria-checked', boolVal);
246+
elem.attr('tabindex', 0 - !boolVal);
247+
};
248+
} else {
249+
return function ngAriaRadioReaction(newVal) {
250+
elem.attr('aria-checked', (attr.value == ngModel.$viewValue));
251+
};
252+
}
253+
}
254+
255+
function ngAriaCheckboxReaction() {
256+
elem.attr('aria-checked', !ngModel.$isEmpty(ngModel.$viewValue));
257+
}
258+
259+
switch (shape) {
260+
case 'radio':
261+
case 'checkbox':
262+
if (shouldAttachRole(shape, elem)) {
263+
elem.attr('role', shape);
264+
}
265+
if (shouldAttachAttr('aria-checked', 'ariaChecked', elem)) {
266+
scope.$watch(ngAriaWatchModelValue, shape === 'radio' ?
267+
getRadioReaction() : ngAriaCheckboxReaction);
268+
}
269+
break;
270+
case 'range':
271+
if (shouldAttachRole(shape, elem)) {
272+
elem.attr('role', 'slider');
273+
}
274+
if ($aria.config('ariaValue')) {
275+
var needsAriaValuemin = !elem.attr('aria-valuemin') &&
276+
(attr.hasOwnProperty('min') || attr.hasOwnProperty('ngMin'));
277+
var needsAriaValuemax = !elem.attr('aria-valuemax') &&
278+
(attr.hasOwnProperty('max') || attr.hasOwnProperty('ngMax'));
279+
var needsAriaValuenow = !elem.attr('aria-valuenow');
280+
281+
if (needsAriaValuemin) {
282+
attr.$observe('min', function ngAriaValueMinReaction(newVal) {
283+
elem.attr('aria-valuemin', newVal);
284+
});
285+
}
286+
if (needsAriaValuemax) {
287+
attr.$observe('max', function ngAriaValueMinReaction(newVal) {
288+
elem.attr('aria-valuemax', newVal);
289+
});
290+
}
291+
if (needsAriaValuenow) {
292+
scope.$watch(ngAriaWatchModelValue, function ngAriaValueNowReaction(newVal) {
293+
elem.attr('aria-valuenow', newVal);
294+
});
295+
}
296+
}
297+
break;
298+
case 'multiline':
299+
if (shouldAttachAttr('aria-multiline', 'ariaMultiline', elem)) {
300+
elem.attr('aria-multiline', true);
301+
}
302+
break;
303+
}
304+
305+
if (needsTabIndex) {
306+
elem.attr('tabindex', 0);
307+
}
308+
309+
if (ngModel.$validators.required && shouldAttachAttr('aria-required', 'ariaRequired', elem)) {
310+
scope.$watch(function ngAriaRequiredWatch() {
311+
return ngModel.$error.required;
312+
}, function ngAriaRequiredReaction(newVal) {
313+
elem.attr('aria-required', !!newVal);
314+
});
315+
}
316+
317+
if (shouldAttachAttr('aria-invalid', 'ariaInvalid', elem)) {
318+
scope.$watch(function ngAriaInvalidWatch() {
319+
return ngModel.$invalid;
320+
}, function ngAriaInvalidReaction(newVal) {
321+
elem.attr('aria-invalid', !!newVal);
322+
});
323+
}
324+
}
325+
};
326+
}
327+
};
328+
}])
329+
.directive('ngDisabled', ['$aria', function($aria) {
330+
return $aria.$$watchExpr('ngDisabled', 'aria-disabled');
331+
}])
332+
.directive('ngMessages', function() {
333+
return {
334+
restrict: 'A',
335+
require: '?ngMessages',
336+
link: function(scope, elem, attr, ngMessages) {
337+
if (!elem.attr('aria-live')) {
338+
elem.attr('aria-live', 'assertive');
339+
}
340+
}
341+
};
342+
})
343+
.directive('ngClick',['$aria', '$parse', function($aria, $parse) {
344+
return {
345+
restrict: 'A',
346+
compile: function(elem, attr) {
347+
var fn = $parse(attr.ngClick, /* interceptorFn */ null, /* expensiveChecks */ true);
348+
return function(scope, elem, attr) {
349+
350+
var nodeBlackList = ['BUTTON', 'A', 'INPUT', 'TEXTAREA'];
351+
352+
function isNodeOneOf(elem, nodeTypeArray) {
353+
if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) {
354+
return true;
355+
}
356+
}
357+
358+
if ($aria.config('bindRoleForClick')
359+
&& !elem.attr('role')
360+
&& !isNodeOneOf(elem, nodeBlackList)) {
361+
elem.attr('role', 'button');
362+
}
363+
364+
if ($aria.config('tabindex') && !elem.attr('tabindex')) {
365+
elem.attr('tabindex', 0);
366+
}
367+
368+
if ($aria.config('bindKeypress') && !attr.ngKeypress && !isNodeOneOf(elem, nodeBlackList)) {
369+
elem.on('keypress', function(event) {
370+
var keyCode = event.which || event.keyCode;
371+
if (keyCode === 32 || keyCode === 13) {
372+
scope.$apply(callback);
373+
}
374+
375+
function callback() {
376+
fn(scope, { $event: event });
377+
}
378+
});
379+
}
380+
};
381+
}
382+
};
383+
}])
384+
.directive('ngDblclick', ['$aria', function($aria) {
385+
return function(scope, elem, attr) {
386+
if ($aria.config('tabindex') && !elem.attr('tabindex')) {
387+
elem.attr('tabindex', 0);
388+
}
389+
};
390+
}]);
391+
392+
393+
})(window, window.angular);

0 commit comments

Comments
 (0)