@angular-wave/angular.ts 0.0.1 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/Makefile +1 -1
  2. package/dist/angular-ts.cjs.js +506 -1696
  3. package/dist/angular-ts.esm.js +506 -1696
  4. package/dist/angular-ts.umd.js +506 -1696
  5. package/package.json +1 -1
  6. package/public/README.md +1 -0
  7. package/src/animations/{animateCss.js → animate-css.js} +0 -1
  8. package/src/animations/animation.js +428 -431
  9. package/src/animations/module.js +9 -9
  10. package/src/core/cache.js +2 -0
  11. package/src/core/compile.js +6 -1102
  12. package/src/core/compile.md +1192 -0
  13. package/src/core/location.js +1 -1
  14. package/src/core/utils.js +1 -1
  15. package/src/directive/a.js +1 -1
  16. package/src/directive/attrs.js +1 -1
  17. package/src/directive/csp.md +89 -0
  18. package/src/directive/input.js +3 -3
  19. package/src/directive/{ngModel.js → model.js} +1 -1
  20. package/src/directive/select.js +5 -5
  21. package/src/jqLite.js +1 -22
  22. package/src/public.js +24 -24
  23. package/src/services/log.js +66 -116
  24. package/src/services/log.md +39 -0
  25. package/test/jqlite.spec.js +5 -35
  26. package/test/messages/messages.spec.js +1 -1
  27. package/test/ng/compile.spec.js +17 -16
  28. package/test/ng/directive/model-options.spec.js +1 -1
  29. package/test/ng/directive/model.spec.js +1 -1
  30. package/test/ng/directive/options.spec.js +61 -61
  31. package/test/ng/directive/select.spec.js +22 -22
  32. package/test/ng/http-backend.spec.js +1 -1
  33. package/test/ng/on.spec.js +1 -1
  34. package/test/ng/prop.spec.js +54 -62
  35. package/test/ng/sanitize-uri.spec.js +1 -1
  36. package/test/ng/scope.spec.js +1 -1
  37. package/test/original-test.html +1 -1
  38. package/types/jqlite.d.ts +1 -32
  39. package/dist/build/angular-mocks.js +0 -3757
  40. package/dist/build/angular-parse-ext.js +0 -1275
  41. package/dist/build/angular-resource.js +0 -911
  42. package/dist/build/angular-touch.js +0 -368
  43. package/src/core/attributes.js +0 -199
  44. package/src/directive/ngCsp.js +0 -82
  45. /package/{dist/build → legacy}/angular-animate.js +0 -0
  46. /package/{dist/build → legacy}/angular-aria.js +0 -0
  47. /package/{dist/build → legacy}/angular-message-format.js +0 -0
  48. /package/{dist/build → legacy}/angular-messages.js +0 -0
  49. /package/{dist/build → legacy}/angular-route.js +0 -0
  50. /package/{dist/build → legacy}/angular-sanitize.js +0 -0
  51. /package/{dist/build → legacy}/angular.js +0 -0
  52. /package/src/animations/{animateCache.js → animate-cache.js} +0 -0
  53. /package/src/animations/{animateChildrenDirective.js → animate-children-directive.js} +0 -0
  54. /package/src/animations/{animateCssDriver.js → animate-css-driver.js} +0 -0
  55. /package/src/animations/{animateJsDriver.js → animate-js-driver.js} +0 -0
  56. /package/src/animations/{animateJs.js → animate-js.js} +0 -0
  57. /package/src/animations/{animateQueue.js → animate-queue.js} +0 -0
  58. /package/src/animations/{ngAnimateSwap.js → animate-swap.js} +0 -0
  59. /package/src/animations/{rafScheduler.js → raf-scheduler.js} +0 -0
  60. /package/src/core/{animateCss.js → animate-css.js} +0 -0
  61. /package/src/core/{animateRunner.js → animate-runner.js} +0 -0
  62. /package/src/core/{exceptionHandler.js → exception-handler.js} +0 -0
  63. /package/src/core/{intervalFactory.js → interval-factory.js} +0 -0
  64. /package/src/core/{rootScope.js → root-scope.js} +0 -0
  65. /package/src/core/{sanitizeUri.js → sanitize-uri.js} +0 -0
  66. /package/src/core/{taskTrackerFactory.js → task-tracker-factory.js} +0 -0
  67. /package/src/directive/{ngClass.js → class.js} +0 -0
  68. /package/src/directive/{ngController.js → controller.js} +0 -0
  69. /package/src/directive/{ngIf.js → if.js} +0 -0
  70. /package/src/directive/{ngInclude.js → include.js} +0 -0
  71. /package/src/directive/{ngModelOptions.js → model-options.js} +0 -0
  72. /package/src/directive/{ngOptions.js → options.js} +0 -0
  73. /package/src/directive/{ngRef.js → ref.js} +0 -0
  74. /package/src/directive/{ngRepeat.js → repeat.js} +0 -0
  75. /package/src/directive/{ngShowHide.js → show-hide.js} +0 -0
  76. /package/src/directive/{ngSwitch.js → switch.js} +0 -0
  77. /package/src/directive/{ngTransclude.js → transclude.js} +0 -0
  78. /package/src/{routeToRegExp.js → route-to-reg-exp.js} +0 -0
  79. /package/src/services/{anchorScroll.js → anchor-scroll.js} +0 -0
  80. /package/src/services/{cacheFactory.js → cache-factory.js} +0 -0
  81. /package/src/services/{cookieReader.js → cookie-reader.js} +0 -0
  82. /package/src/services/{httpBackend.js → http-backend.js} +0 -0
  83. /package/src/services/{templateRequest.js → template-request.js} +0 -0
  84. /package/test/ng/{anomate.spec.js → animate.spec.js} +0 -0
@@ -1,368 +0,0 @@
1
- /**
2
- * @license AngularJS v1.8.4-local+sha.4e1bd4b90
3
- * (c) 2010-2020 Google LLC. http://angularjs.org
4
- * License: MIT
5
- */
6
- (function(window, angular) {'use strict';
7
-
8
- /**
9
- * @ngdoc module
10
- * @name ngTouch
11
- * @description
12
- *
13
- * The `ngTouch` module provides helpers for touch-enabled devices.
14
- * The implementation is based on jQuery Mobile touch event handling
15
- * ([jquerymobile.com](http://jquerymobile.com/)). *
16
- *
17
- * See {@link ngTouch.$swipe `$swipe`} for usage.
18
- *
19
- * @deprecated
20
- * sinceVersion="1.7.0"
21
- * The ngTouch module with the {@link ngTouch.$swipe `$swipe`} service and
22
- * the {@link ngTouch.ngSwipeLeft} and {@link ngTouch.ngSwipeRight} directives are
23
- * deprecated. Instead, stand-alone libraries for touch handling and gesture interaction
24
- * should be used, for example [HammerJS](https://hammerjs.github.io/) (which is also used by
25
- * Angular).
26
- */
27
-
28
- // define ngTouch module
29
- /* global ngTouch */
30
- var ngTouch = angular.module('ngTouch', []);
31
-
32
- ngTouch.info({ angularVersion: '1.8.4-local+sha.4e1bd4b90' });
33
-
34
- function nodeName_(element) {
35
- return angular.$$lowercase(element.nodeName || (element[0] && element[0].nodeName));
36
- }
37
-
38
- /* global ngTouch: false */
39
-
40
- /**
41
- * @ngdoc service
42
- * @name $swipe
43
- *
44
- * @deprecated
45
- * sinceVersion="1.7.0"
46
- *
47
- * See the {@link ngTouch module} documentation for more information.
48
- *
49
- * @description
50
- * The `$swipe` service is a service that abstracts the messier details of hold-and-drag swipe
51
- * behavior, to make implementing swipe-related directives more convenient.
52
- *
53
- * Requires the {@link ngTouch `ngTouch`} module to be installed.
54
- *
55
- * `$swipe` is used by the `ngSwipeLeft` and `ngSwipeRight` directives in `ngTouch`.
56
- *
57
- * # Usage
58
- * The `$swipe` service is an object with a single method: `bind`. `bind` takes an element
59
- * which is to be watched for swipes, and an object with four handler functions. See the
60
- * documentation for `bind` below.
61
- */
62
-
63
- ngTouch.factory('$swipe', [function() {
64
- // The total distance in any direction before we make the call on swipe vs. scroll.
65
- var MOVE_BUFFER_RADIUS = 10;
66
-
67
- var POINTER_EVENTS = {
68
- 'mouse': {
69
- start: 'mousedown',
70
- move: 'mousemove',
71
- end: 'mouseup'
72
- },
73
- 'touch': {
74
- start: 'touchstart',
75
- move: 'touchmove',
76
- end: 'touchend',
77
- cancel: 'touchcancel'
78
- },
79
- 'pointer': {
80
- start: 'pointerdown',
81
- move: 'pointermove',
82
- end: 'pointerup',
83
- cancel: 'pointercancel'
84
- }
85
- };
86
-
87
- function getCoordinates(event) {
88
- var originalEvent = event.originalEvent || event;
89
- var touches = originalEvent.touches && originalEvent.touches.length ? originalEvent.touches : [originalEvent];
90
- var e = (originalEvent.changedTouches && originalEvent.changedTouches[0]) || touches[0];
91
-
92
- return {
93
- x: e.clientX,
94
- y: e.clientY
95
- };
96
- }
97
-
98
- function getEvents(pointerTypes, eventType) {
99
- var res = [];
100
- angular.forEach(pointerTypes, function(pointerType) {
101
- var eventName = POINTER_EVENTS[pointerType][eventType];
102
- if (eventName) {
103
- res.push(eventName);
104
- }
105
- });
106
- return res.join(' ');
107
- }
108
-
109
- return {
110
- /**
111
- * @ngdoc method
112
- * @name $swipe#bind
113
- *
114
- * @description
115
- * The main method of `$swipe`. It takes an element to be watched for swipe motions, and an
116
- * object containing event handlers.
117
- * The pointer types that should be used can be specified via the optional
118
- * third argument, which is an array of strings `'mouse'`, `'touch'` and `'pointer'`. By default,
119
- * `$swipe` will listen for `mouse`, `touch` and `pointer` events.
120
- *
121
- * The four events are `start`, `move`, `end`, and `cancel`. `start`, `move`, and `end`
122
- * receive as a parameter a coordinates object of the form `{ x: 150, y: 310 }` and the raw
123
- * `event`. `cancel` receives the raw `event` as its single parameter.
124
- *
125
- * `start` is called on either `mousedown`, `touchstart` or `pointerdown`. After this event, `$swipe` is
126
- * watching for `touchmove`, `mousemove` or `pointermove` events. These events are ignored until the total
127
- * distance moved in either dimension exceeds a small threshold.
128
- *
129
- * Once this threshold is exceeded, either the horizontal or vertical delta is greater.
130
- * - If the horizontal distance is greater, this is a swipe and `move` and `end` events follow.
131
- * - If the vertical distance is greater, this is a scroll, and we let the browser take over.
132
- * A `cancel` event is sent.
133
- *
134
- * `move` is called on `mousemove`, `touchmove` and `pointermove` after the above logic has determined that
135
- * a swipe is in progress.
136
- *
137
- * `end` is called when a swipe is successfully completed with a `touchend`, `mouseup` or `pointerup`.
138
- *
139
- * `cancel` is called either on a `touchcancel` or `pointercancel` from the browser, or when we begin scrolling
140
- * as described above.
141
- *
142
- */
143
- bind: function(element, eventHandlers, pointerTypes) {
144
- // Absolute total movement, used to control swipe vs. scroll.
145
- var totalX, totalY;
146
- // Coordinates of the start position.
147
- var startCoords;
148
- // Last event's position.
149
- var lastPos;
150
- // Whether a swipe is active.
151
- var active = false;
152
-
153
- pointerTypes = pointerTypes || ['mouse', 'touch', 'pointer'];
154
- element.on(getEvents(pointerTypes, 'start'), function(event) {
155
- startCoords = getCoordinates(event);
156
- active = true;
157
- totalX = 0;
158
- totalY = 0;
159
- lastPos = startCoords;
160
- if (eventHandlers['start']) {
161
- eventHandlers['start'](startCoords, event);
162
- }
163
- });
164
- var events = getEvents(pointerTypes, 'cancel');
165
- if (events) {
166
- element.on(events, function(event) {
167
- active = false;
168
- if (eventHandlers['cancel']) {
169
- eventHandlers['cancel'](event);
170
- }
171
- });
172
- }
173
-
174
- element.on(getEvents(pointerTypes, 'move'), function(event) {
175
- if (!active) return;
176
-
177
- // Android will send a touchcancel if it thinks we're starting to scroll.
178
- // So when the total distance (+ or - or both) exceeds 10px in either direction,
179
- // we either:
180
- // - On totalX > totalY, we send preventDefault() and treat this as a swipe.
181
- // - On totalY > totalX, we let the browser handle it as a scroll.
182
-
183
- if (!startCoords) return;
184
- var coords = getCoordinates(event);
185
-
186
- totalX += Math.abs(coords.x - lastPos.x);
187
- totalY += Math.abs(coords.y - lastPos.y);
188
-
189
- lastPos = coords;
190
-
191
- if (totalX < MOVE_BUFFER_RADIUS && totalY < MOVE_BUFFER_RADIUS) {
192
- return;
193
- }
194
-
195
- // One of totalX or totalY has exceeded the buffer, so decide on swipe vs. scroll.
196
- if (totalY > totalX) {
197
- // Allow native scrolling to take over.
198
- active = false;
199
- if (eventHandlers['cancel']) {
200
- eventHandlers['cancel'](event);
201
- }
202
- return;
203
- } else {
204
- // Prevent the browser from scrolling.
205
- event.preventDefault();
206
- if (eventHandlers['move']) {
207
- eventHandlers['move'](coords, event);
208
- }
209
- }
210
- });
211
-
212
- element.on(getEvents(pointerTypes, 'end'), function(event) {
213
- if (!active) return;
214
- active = false;
215
- if (eventHandlers['end']) {
216
- eventHandlers['end'](getCoordinates(event), event);
217
- }
218
- });
219
- }
220
- };
221
- }]);
222
-
223
- /* global ngTouch: false */
224
-
225
- /**
226
- * @ngdoc directive
227
- * @name ngSwipeLeft
228
- *
229
- * @deprecated
230
- * sinceVersion="1.7.0"
231
- *
232
- * See the {@link ngTouch module} documentation for more information.
233
- *
234
- * @description
235
- * Specify custom behavior when an element is swiped to the left on a touchscreen device.
236
- * A leftward swipe is a quick, right-to-left slide of the finger.
237
- * Though ngSwipeLeft is designed for touch-based devices, it will work with a mouse click and drag
238
- * too.
239
- *
240
- * To disable the mouse click and drag functionality, add `ng-swipe-disable-mouse` to
241
- * the `ng-swipe-left` or `ng-swipe-right` DOM Element.
242
- *
243
- * Requires the {@link ngTouch `ngTouch`} module to be installed.
244
- *
245
- * @element ANY
246
- * @param {expression} ngSwipeLeft {@link guide/expression Expression} to evaluate
247
- * upon left swipe. (Event object is available as `$event`)
248
- *
249
- * @example
250
- <example module="ngSwipeLeftExample" deps="angular-touch.js" name="ng-swipe-left">
251
- <file name="index.html">
252
- <div ng-show="!showActions" ng-swipe-left="showActions = true">
253
- Some list content, like an email in the inbox
254
- </div>
255
- <div ng-show="showActions" ng-swipe-right="showActions = false">
256
- <button ng-click="reply()">Reply</button>
257
- <button ng-click="delete()">Delete</button>
258
- </div>
259
- </file>
260
- <file name="script.js">
261
- angular.module('ngSwipeLeftExample', ['ngTouch']);
262
- </file>
263
- </example>
264
- */
265
-
266
- /**
267
- * @ngdoc directive
268
- * @name ngSwipeRight
269
- *
270
- * @deprecated
271
- * sinceVersion="1.7.0"
272
- *
273
- * See the {@link ngTouch module} documentation for more information.
274
- *
275
- * @description
276
- * Specify custom behavior when an element is swiped to the right on a touchscreen device.
277
- * A rightward swipe is a quick, left-to-right slide of the finger.
278
- * Though ngSwipeRight is designed for touch-based devices, it will work with a mouse click and drag
279
- * too.
280
- *
281
- * Requires the {@link ngTouch `ngTouch`} module to be installed.
282
- *
283
- * @element ANY
284
- * @param {expression} ngSwipeRight {@link guide/expression Expression} to evaluate
285
- * upon right swipe. (Event object is available as `$event`)
286
- *
287
- * @example
288
- <example module="ngSwipeRightExample" deps="angular-touch.js" name="ng-swipe-right">
289
- <file name="index.html">
290
- <div ng-show="!showActions" ng-swipe-left="showActions = true">
291
- Some list content, like an email in the inbox
292
- </div>
293
- <div ng-show="showActions" ng-swipe-right="showActions = false">
294
- <button ng-click="reply()">Reply</button>
295
- <button ng-click="delete()">Delete</button>
296
- </div>
297
- </file>
298
- <file name="script.js">
299
- angular.module('ngSwipeRightExample', ['ngTouch']);
300
- </file>
301
- </example>
302
- */
303
-
304
- function makeSwipeDirective(directiveName, direction, eventName) {
305
- ngTouch.directive(directiveName, ['$parse', '$swipe', function($parse, $swipe) {
306
- // The maximum vertical delta for a swipe should be less than 75px.
307
- var MAX_VERTICAL_DISTANCE = 75;
308
- // Vertical distance should not be more than a fraction of the horizontal distance.
309
- var MAX_VERTICAL_RATIO = 0.3;
310
- // At least a 30px lateral motion is necessary for a swipe.
311
- var MIN_HORIZONTAL_DISTANCE = 30;
312
-
313
- return function(scope, element, attr) {
314
- var swipeHandler = $parse(attr[directiveName]);
315
-
316
- var startCoords, valid;
317
-
318
- function validSwipe(coords) {
319
- // Check that it's within the coordinates.
320
- // Absolute vertical distance must be within tolerances.
321
- // Horizontal distance, we take the current X - the starting X.
322
- // This is negative for leftward swipes and positive for rightward swipes.
323
- // After multiplying by the direction (-1 for left, +1 for right), legal swipes
324
- // (ie. same direction as the directive wants) will have a positive delta and
325
- // illegal ones a negative delta.
326
- // Therefore this delta must be positive, and larger than the minimum.
327
- if (!startCoords) return false;
328
- var deltaY = Math.abs(coords.y - startCoords.y);
329
- var deltaX = (coords.x - startCoords.x) * direction;
330
- return valid && // Short circuit for already-invalidated swipes.
331
- deltaY < MAX_VERTICAL_DISTANCE &&
332
- deltaX > 0 &&
333
- deltaX > MIN_HORIZONTAL_DISTANCE &&
334
- deltaY / deltaX < MAX_VERTICAL_RATIO;
335
- }
336
-
337
- var pointerTypes = ['touch'];
338
- if (!angular.isDefined(attr['ngSwipeDisableMouse'])) {
339
- pointerTypes.push('mouse');
340
- }
341
- $swipe.bind(element, {
342
- 'start': function(coords, event) {
343
- startCoords = coords;
344
- valid = true;
345
- },
346
- 'cancel': function(event) {
347
- valid = false;
348
- },
349
- 'end': function(coords, event) {
350
- if (validSwipe(coords)) {
351
- scope.$apply(function() {
352
- element.triggerHandler(eventName);
353
- swipeHandler(scope, {$event: event});
354
- });
355
- }
356
- }
357
- }, pointerTypes);
358
- };
359
- }]);
360
- }
361
-
362
- // Left is negative X-coordinate, right is positive.
363
- makeSwipeDirective('ngSwipeLeft', -1, 'swipeleft');
364
- makeSwipeDirective('ngSwipeRight', 1, 'swiperight');
365
-
366
-
367
-
368
- })(window, window.angular);
@@ -1,199 +0,0 @@
1
- export class Attributes {
2
- constructor(element, attributesToCopy) {
3
- if (attributesToCopy) {
4
- const keys = Object.keys(attributesToCopy);
5
- for (let i = 0, l = keys.length; i < l; i++) {
6
- const key = keys[i];
7
- this[key] = attributesToCopy[key];
8
- }
9
- } else {
10
- this.$attr = {};
11
- }
12
-
13
- this.$$element = element;
14
- }
15
-
16
- /**
17
- * @ngdoc method
18
- * @name $compile.directive.Attributes#$normalize
19
- * @kind function
20
- *
21
- * @description
22
- * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or
23
- * `data-`) to its normalized, camelCase form.
24
- *
25
- * Also there is special case for Moz prefix starting with upper case letter.
26
- *
27
- * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
28
- *
29
- * @param {string} name Name to normalize
30
- */
31
- $normalize(name) {
32
- return directiveNormalize(name);
33
- }
34
-
35
- /**
36
- * @ngdoc method
37
- * @name $compile.directive.Attributes#$addClass
38
- * @kind function
39
- *
40
- * @description
41
- * Adds the CSS class value specified by the classVal parameter to the element. If animations
42
- * are enabled then an animation will be triggered for the class addition.
43
- *
44
- * @param {string} classVal The className value that will be added to the element
45
- */
46
- $addClass(classVal) {
47
- if (classVal && classVal.length > 0) {
48
- $animate.addClass(this.$$element, classVal);
49
- }
50
- }
51
-
52
- /**
53
- * @ngdoc method
54
- * @name $compile.directive.Attributes#$removeClass
55
- * @kind function
56
- *
57
- * @description
58
- * Removes the CSS class value specified by the classVal parameter from the element. If
59
- * animations are enabled then an animation will be triggered for the class removal.
60
- *
61
- * @param {string} classVal The className value that will be removed from the element
62
- */
63
- $removeClass(classVal) {
64
- if (classVal && classVal.length > 0) {
65
- $animate.removeClass(this.$$element, classVal);
66
- }
67
- }
68
-
69
- /**
70
- * @ngdoc method
71
- * @name $compile.directive.Attributes#$updateClass
72
- * @kind function
73
- *
74
- * @description
75
- * Adds and removes the appropriate CSS class values to the element based on the difference
76
- * between the new and old CSS class values (specified as newClasses and oldClasses).
77
- *
78
- * @param {string} newClasses The current CSS className value
79
- * @param {string} oldClasses The former CSS className value
80
- */
81
- $updateClass(newClasses, oldClasses) {
82
- const toAdd = tokenDifference(newClasses, oldClasses);
83
- if (toAdd && toAdd.length) {
84
- $animate.addClass(this.$$element, toAdd);
85
- }
86
-
87
- const toRemove = tokenDifference(oldClasses, newClasses);
88
- if (toRemove && toRemove.length) {
89
- $animate.removeClass(this.$$element, toRemove);
90
- }
91
- }
92
-
93
- /**
94
- * Set a normalized attribute on the element in a way such that all directives
95
- * can share the attribute. This function properly handles boolean attributes.
96
- * @param {string} key Normalized key. (ie ngAttribute)
97
- * @param {string|boolean} value The value to set. If `null` attribute will be deleted.
98
- * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.
99
- * Defaults to true.
100
- * @param {string=} attrName Optional none normalized name. Defaults to key.
101
- */
102
- $set(key, value, writeAttr = true, attrName) {
103
- const node = this.$$element[0];
104
- const booleanKey = getBooleanAttrName(node, key);
105
- const aliasedKey = ALIASED_ATTR[key];
106
- let observer = key;
107
- let nodeName;
108
-
109
- if (booleanKey) {
110
- this.$$element.prop(key, value);
111
- attrName = booleanKey;
112
- } else if (aliasedKey) {
113
- this[aliasedKey] = value;
114
- observer = aliasedKey;
115
- }
116
-
117
- this[key] = value;
118
-
119
- if (attrName) {
120
- this.$attr[key] = attrName;
121
- } else {
122
- attrName = this.$attr[key];
123
- if (!attrName) {
124
- this.$attr[key] = attrName = snakeCase(key, "-");
125
- }
126
- }
127
-
128
- nodeName = nodeName_(this.$$element);
129
-
130
- if (nodeName === "img" && key === "srcset") {
131
- this[key] = value = sanitizeSrcset(value, "$set('srcset', value)");
132
- }
133
-
134
- if (writeAttr !== false) {
135
- if (value === null || isUndefined(value)) {
136
- this.$$element[0].removeAttribute(attrName);
137
- } else if (SIMPLE_ATTR_NAME.test(attrName)) {
138
- if (booleanKey && value === false) {
139
- this.$$element[0].removeAttribute(attrName);
140
- } else {
141
- this.$$element.attr(attrName, value);
142
- }
143
- } else {
144
- setSpecialAttr(this.$$element[0], attrName, value);
145
- }
146
- }
147
-
148
- const { $$observers } = this;
149
- if ($$observers) {
150
- forEach($$observers[observer], (fn) => {
151
- try {
152
- fn(value);
153
- } catch (e) {
154
- $exceptionHandler(e);
155
- }
156
- });
157
- }
158
- }
159
-
160
- /**
161
- * @ngdoc method
162
- * @name $compile.directive.Attributes#$observe
163
- * @kind function
164
- *
165
- * @description
166
- * Observes an interpolated attribute.
167
- *
168
- * The observer function will be invoked once during the next `$digest` following
169
- * compilation. The observer is then invoked whenever the interpolated value
170
- * changes.
171
- *
172
- * @param {string} key Normalized key. (ie ngAttribute) .
173
- * @param {function(interpolatedValue)} fn Function that will be called whenever
174
- the interpolated value of the attribute changes.
175
- * See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation
176
- * guide} for more info.
177
- * @returns {function()} Returns a deregistration function for this observer.
178
- */
179
- $observe(key, fn) {
180
- const attrs = this;
181
- const $$observers = attrs.$$observers || (attrs.$$observers = createMap());
182
- const listeners = $$observers[key] || ($$observers[key] = []);
183
-
184
- listeners.push(fn);
185
- $rootScope.$evalAsync(() => {
186
- if (
187
- !listeners.$$inter &&
188
- Object.prototype.hasOwnProperty.call(attrs, key) &&
189
- !isUndefined(attrs[key])
190
- ) {
191
- fn(attrs[key]);
192
- }
193
- });
194
-
195
- return function () {
196
- arrayRemove(listeners, fn);
197
- };
198
- }
199
- }
@@ -1,82 +0,0 @@
1
- /**
2
- * @ngdoc directive
3
- * @name ngCsp
4
- *
5
- * @restrict A
6
- * @element ANY
7
- * @description
8
- *
9
- * AngularJS has some features that can conflict with certain restrictions that are applied when using
10
- * [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.
11
- *
12
- * If you intend to implement CSP with these rules then you must tell AngularJS not to use these
13
- * features.
14
- *
15
- * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.
16
- *
17
- *
18
- * The following default rules in CSP affect AngularJS:
19
- *
20
- * * The use of `eval()`, `Function(string)` and similar functions to dynamically create and execute
21
- * code from strings is forbidden. AngularJS makes use of this in the {@link $parse} service to
22
- * provide a 30% increase in the speed of evaluating AngularJS expressions. (This CSP rule can be
23
- * disabled with the CSP keyword `unsafe-eval`, but it is generally not recommended as it would
24
- * weaken the protections offered by CSP.)
25
- *
26
- * * The use of inline resources, such as inline `<script>` and `<style>` elements, are forbidden.
27
- * This prevents apps from injecting custom styles directly into the document. AngularJS makes use of
28
- * this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}). To make these
29
- * directives work when a CSP rule is blocking inline styles, you must link to the `angular-csp.css`
30
- * in your HTML manually. (This CSP rule can be disabled with the CSP keyword `unsafe-inline`, but
31
- * it is generally not recommended as it would weaken the protections offered by CSP.)
32
- *
33
- * If you do not provide `ngCsp` then AngularJS tries to autodetect if CSP is blocking dynamic code
34
- * creation from strings (e.g., `unsafe-eval` not specified in CSP header) and automatically
35
- * deactivates this feature in the {@link $parse} service. This autodetection, however, triggers a
36
- * CSP error to be logged in the console:
37
- *
38
- * ```
39
- * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
40
- * script in the following Content Security Policy directive: "default-src 'self'". Note that
41
- * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
42
- * ```
43
- *
44
- * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`
45
- * directive on an element of the HTML document that appears before the `<script>` tag that loads
46
- * the `angular.js` file.
47
- *
48
- * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*
49
- *
50
- * You can specify which of the CSP related AngularJS features should be deactivated by providing
51
- * a value for the `ng-csp` attribute. The options are as follows:
52
- *
53
- * * no-inline-style: this stops AngularJS from injecting CSS styles into the DOM
54
- *
55
- * * no-unsafe-eval: this stops AngularJS from optimizing $parse with unsafe eval of strings
56
- *
57
- * You can use these values in the following combinations:
58
- *
59
- *
60
- * * No declaration means that AngularJS will assume that you can do inline styles, but it will do
61
- * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous
62
- * versions of AngularJS.
63
- *
64
- * * A simple `ng-csp` (or `data-ng-csp`) attribute will tell AngularJS to deactivate both inline
65
- * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous
66
- * versions of AngularJS.
67
- *
68
- * * Specifying only `no-unsafe-eval` tells AngularJS that we must not use eval, but that we can
69
- * inject inline styles. E.g. `<body ng-csp="no-unsafe-eval">`.
70
- *
71
- * * Specifying only `no-inline-style` tells AngularJS that we must not inject styles, but that we can
72
- * run eval - no automatic check for unsafe eval will occur. E.g. `<body ng-csp="no-inline-style">`
73
- *
74
- * * Specifying both `no-unsafe-eval` and `no-inline-style` tells AngularJS that we must not inject
75
- * styles nor use eval, which is the same as an empty: ng-csp.
76
- * E.g.`<body ng-csp="no-inline-style;no-unsafe-eval">`
77
-
78
- // `ngCsp` is not implemented as a proper directive any more, because we need it be processed while
79
- // we bootstrap the app (before `$parse` is instantiated). For this reason, we just have the `csp()`
80
- // fn that looks for the `ng-csp` attribute anywhere in the current doc.
81
- // TODO MOVE CSP to PARSE CONFIG as this should not even be a directive
82
- */
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes