@angular-wave/angular.ts 0.0.45 → 0.0.47

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@angular-wave/angular.ts",
3
3
  "license": "MIT",
4
- "version": "0.0.45",
4
+ "version": "0.0.47",
5
5
  "type": "module",
6
6
  "main": "dist/angular-ts.esm.js",
7
7
  "browser": "dist/angular-ts.umd.js",
@@ -21,7 +21,7 @@ import {
21
21
  toJson,
22
22
  fromJson,
23
23
  nextUid,
24
- nodeName_,
24
+ getNodeName,
25
25
  snakeCase,
26
26
  } from "./shared/utils";
27
27
  import { dealoc, JQLite, startingTag } from "./shared/jqlite/jqlite";
@@ -1827,14 +1827,14 @@ describe("angular", () => {
1827
1827
  });
1828
1828
  });
1829
1829
 
1830
- describe("nodeName_", () => {
1830
+ describe("getNodeName", () => {
1831
1831
  it('should correctly detect node name with "namespace" when xmlns is defined', () => {
1832
1832
  const div = JQLite(
1833
1833
  '<div xmlns:ngtest="http://angularjs.org/">' +
1834
1834
  '<ngtest:foo ngtest:attr="bar"></ngtest:foo>' +
1835
1835
  "</div>",
1836
1836
  )[0];
1837
- expect(nodeName_(div.childNodes[0])).toBe("ngtest:foo");
1837
+ expect(getNodeName(div.childNodes[0])).toBe("ngtest:foo");
1838
1838
  expect(div.childNodes[0].getAttribute("ngtest:attr")).toBe("bar");
1839
1839
  });
1840
1840
 
@@ -1844,13 +1844,13 @@ describe("angular", () => {
1844
1844
  '<ngtest:foo ngtest:attr="bar"></ng-test>' +
1845
1845
  "</div>",
1846
1846
  )[0];
1847
- expect(nodeName_(div.childNodes[0])).toBe("ngtest:foo");
1847
+ expect(getNodeName(div.childNodes[0])).toBe("ngtest:foo");
1848
1848
  expect(div.childNodes[0].getAttribute("ngtest:attr")).toBe("bar");
1849
1849
  });
1850
1850
 
1851
1851
  it("should return undefined for elements without the .nodeName property", () => {
1852
1852
  // some elements, like SVGElementInstance don't have .nodeName property
1853
- expect(nodeName_({})).toBeUndefined();
1853
+ expect(getNodeName({})).toBeUndefined();
1854
1854
  });
1855
1855
  });
1856
1856
 
@@ -137,7 +137,7 @@ export const $$AnimateCssDriverProvider = [
137
137
 
138
138
  // we iterate directly since safari messes up and doesn't return
139
139
  // all the keys for the coords object when iterated
140
- forEach(["width", "height", "top", "left"], (key) => {
140
+ ["width", "height", "top", "left"].forEach((key) => {
141
141
  let value = coords[key];
142
142
  switch (key) {
143
143
  case "top":
@@ -54,7 +54,7 @@ export const $$AnimateQueueProvider = [
54
54
  const keys = classString.split(ONE_SPACE);
55
55
  const map = Object.create(null);
56
56
 
57
- forEach(keys, (key) => {
57
+ keys.forEach((key) => {
58
58
  map[key] = true;
59
59
  });
60
60
  return map;
@@ -256,7 +256,7 @@ export const $$AnimateQueueProvider = [
256
256
  const matches = [];
257
257
  const entries = callbackRegistry[event];
258
258
  if (entries) {
259
- forEach(entries, (entry) => {
259
+ entries.forEach((entry) => {
260
260
  if (contains.call(entry.node, targetNode)) {
261
261
  matches.push(entry.callback);
262
262
  } else if (
@@ -694,7 +694,7 @@ export const $$AnimateQueueProvider = [
694
694
  runInNextPostDigestOrNow(() => {
695
695
  const callbacks = findCallbacks(parentNode, node, event);
696
696
  if (callbacks.length) {
697
- forEach(callbacks, (callback) => {
697
+ callbacks.forEach((callback) => {
698
698
  callback(element, phase, data);
699
699
  });
700
700
  cleanupEventListeners(phase, node);
@@ -26,7 +26,7 @@ import {
26
26
  inherit,
27
27
  isUndefined,
28
28
  arrayRemove,
29
- nodeName_,
29
+ getNodeName,
30
30
  bind,
31
31
  trim,
32
32
  isBoolean,
@@ -1120,7 +1120,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1120
1120
  if (!node) {
1121
1121
  return "html";
1122
1122
  }
1123
- return nodeName_(node) !== "foreignobject" &&
1123
+ return getNodeName(node) !== "foreignobject" &&
1124
1124
  toString.call(node).match(/SVG/)
1125
1125
  ? "svg"
1126
1126
  : "html";
@@ -1822,7 +1822,8 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1822
1822
  // Add the matching elements into their slot
1823
1823
 
1824
1824
  forEach(JQLite($compileNode[0].childNodes), (node) => {
1825
- const slotName = slotMap[directiveNormalize(nodeName_(node))];
1825
+ const slotName =
1826
+ slotMap[directiveNormalize(getNodeName(node))];
1826
1827
  if (slotName) {
1827
1828
  filledSlots[slotName] = true;
1828
1829
  slots[slotName] =
@@ -2911,7 +2912,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
2911
2912
  );
2912
2913
  }
2913
2914
 
2914
- const nodeName = nodeName_(node);
2915
+ const nodeName = getNodeName(node);
2915
2916
  const trustedContext = getTrustedPropContext(nodeName, propName);
2916
2917
 
2917
2918
  let sanitizer = (x) => x;
@@ -2969,7 +2970,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
2969
2970
  name,
2970
2971
  isNgAttr,
2971
2972
  ) {
2972
- const nodeName = nodeName_(node);
2973
+ const nodeName = getNodeName(node);
2973
2974
  const trustedContext = getTrustedAttrContext(nodeName, name);
2974
2975
  const mustHaveExpression = !isNgAttr;
2975
2976
  const allOrNothing = ALL_OR_NOTHING_ATTRS[name] || isNgAttr;
@@ -6,7 +6,7 @@ import {
6
6
  isFunction,
7
7
  valueFn,
8
8
  isElement,
9
- nodeName_,
9
+ getNodeName,
10
10
  extend,
11
11
  } from "../../shared/utils";
12
12
  import { countChildScopes, countWatchers } from "../../core/scope/scope";
@@ -5603,7 +5603,7 @@ describe("$compile", () => {
5603
5603
  expect(() => {
5604
5604
  element = $compile("<div replace-with-tr></div>")($rootScope);
5605
5605
  }).not.toThrow();
5606
- expect(nodeName_(element)).toMatch(/tr/i);
5606
+ expect(getNodeName(element)).toMatch(/tr/i);
5607
5607
  });
5608
5608
 
5609
5609
  it("should support templates with root <td> tags", () => {
@@ -5611,7 +5611,7 @@ describe("$compile", () => {
5611
5611
  expect(() => {
5612
5612
  element = $compile("<div replace-with-td></div>")($rootScope);
5613
5613
  }).not.toThrow();
5614
- expect(nodeName_(element)).toMatch(/td/i);
5614
+ expect(getNodeName(element)).toMatch(/td/i);
5615
5615
  });
5616
5616
 
5617
5617
  it("should support templates with root <th> tags", () => {
@@ -5619,7 +5619,7 @@ describe("$compile", () => {
5619
5619
  expect(() => {
5620
5620
  element = $compile("<div replace-with-th></div>")($rootScope);
5621
5621
  }).not.toThrow();
5622
- expect(nodeName_(element)).toMatch(/th/i);
5622
+ expect(getNodeName(element)).toMatch(/th/i);
5623
5623
  });
5624
5624
 
5625
5625
  it("should support templates with root <thead> tags", () => {
@@ -5627,7 +5627,7 @@ describe("$compile", () => {
5627
5627
  expect(() => {
5628
5628
  element = $compile("<div replace-with-thead></div>")($rootScope);
5629
5629
  }).not.toThrow();
5630
- expect(nodeName_(element)).toMatch(/thead/i);
5630
+ expect(getNodeName(element)).toMatch(/thead/i);
5631
5631
  });
5632
5632
 
5633
5633
  it("should support templates with root <tbody> tags", () => {
@@ -5635,7 +5635,7 @@ describe("$compile", () => {
5635
5635
  expect(() => {
5636
5636
  element = $compile("<div replace-with-tbody></div>")($rootScope);
5637
5637
  }).not.toThrow();
5638
- expect(nodeName_(element)).toMatch(/tbody/i);
5638
+ expect(getNodeName(element)).toMatch(/tbody/i);
5639
5639
  });
5640
5640
 
5641
5641
  it("should support templates with root <tfoot> tags", () => {
@@ -5643,7 +5643,7 @@ describe("$compile", () => {
5643
5643
  expect(() => {
5644
5644
  element = $compile("<div replace-with-tfoot></div>")($rootScope);
5645
5645
  }).not.toThrow();
5646
- expect(nodeName_(element)).toMatch(/tfoot/i);
5646
+ expect(getNodeName(element)).toMatch(/tfoot/i);
5647
5647
  });
5648
5648
 
5649
5649
  it("should support templates with root <option> tags", () => {
@@ -5651,7 +5651,7 @@ describe("$compile", () => {
5651
5651
  expect(() => {
5652
5652
  element = $compile("<div replace-with-option></div>")($rootScope);
5653
5653
  }).not.toThrow();
5654
- expect(nodeName_(element)).toMatch(/option/i);
5654
+ expect(getNodeName(element)).toMatch(/option/i);
5655
5655
  });
5656
5656
 
5657
5657
  it("should support templates with root <optgroup> tags", () => {
@@ -5659,7 +5659,7 @@ describe("$compile", () => {
5659
5659
  expect(() => {
5660
5660
  element = $compile("<div replace-with-optgroup></div>")($rootScope);
5661
5661
  }).not.toThrow();
5662
- expect(nodeName_(element)).toMatch(/optgroup/i);
5662
+ expect(getNodeName(element)).toMatch(/optgroup/i);
5663
5663
  });
5664
5664
 
5665
5665
  it("should support SVG templates using directive.templateNamespace=svg", () => {
@@ -5681,7 +5681,7 @@ describe("$compile", () => {
5681
5681
  )($rootScope);
5682
5682
  const child = element.children().eq(0);
5683
5683
  $rootScope.$digest();
5684
- expect(nodeName_(child)).toMatch(/a/i);
5684
+ expect(getNodeName(child)).toMatch(/a/i);
5685
5685
  expect(isSVGElement(child[0])).toBe(true);
5686
5686
  expect(child[0].href.baseVal).toBe("/foo/bar");
5687
5687
  });
@@ -5710,7 +5710,7 @@ describe("$compile", () => {
5710
5710
  );
5711
5711
  $rootScope.$digest();
5712
5712
  const child = element.children().eq(0);
5713
- expect(nodeName_(child)).toMatch(/msup/i);
5713
+ expect(getNodeName(child)).toMatch(/msup/i);
5714
5714
  expect(isUnknownElement(child[0])).toBe(false);
5715
5715
  expect(isHTMLElement(child[0])).toBe(false);
5716
5716
  });
@@ -6566,7 +6566,7 @@ describe("$compile", () => {
6566
6566
  element = $compile("<div replace-with-tr></div>")($rootScope);
6567
6567
  }).not.toThrow();
6568
6568
  $rootScope.$digest();
6569
- expect(nodeName_(element)).toMatch(/tr/i);
6569
+ expect(getNodeName(element)).toMatch(/tr/i);
6570
6570
  });
6571
6571
 
6572
6572
  it("should support templates with root <td> tags", () => {
@@ -6575,7 +6575,7 @@ describe("$compile", () => {
6575
6575
  element = $compile("<div replace-with-td></div>")($rootScope);
6576
6576
  }).not.toThrow();
6577
6577
  $rootScope.$digest();
6578
- expect(nodeName_(element)).toMatch(/td/i);
6578
+ expect(getNodeName(element)).toMatch(/td/i);
6579
6579
  });
6580
6580
 
6581
6581
  it("should support templates with root <th> tags", () => {
@@ -6584,7 +6584,7 @@ describe("$compile", () => {
6584
6584
  element = $compile("<div replace-with-th></div>")($rootScope);
6585
6585
  }).not.toThrow();
6586
6586
  $rootScope.$digest();
6587
- expect(nodeName_(element)).toMatch(/th/i);
6587
+ expect(getNodeName(element)).toMatch(/th/i);
6588
6588
  });
6589
6589
 
6590
6590
  it("should support templates with root <thead> tags", () => {
@@ -6593,7 +6593,7 @@ describe("$compile", () => {
6593
6593
  element = $compile("<div replace-with-thead></div>")($rootScope);
6594
6594
  }).not.toThrow();
6595
6595
  $rootScope.$digest();
6596
- expect(nodeName_(element)).toMatch(/thead/i);
6596
+ expect(getNodeName(element)).toMatch(/thead/i);
6597
6597
  });
6598
6598
 
6599
6599
  it("should support templates with root <tbody> tags", () => {
@@ -6602,7 +6602,7 @@ describe("$compile", () => {
6602
6602
  element = $compile("<div replace-with-tbody></div>")($rootScope);
6603
6603
  }).not.toThrow();
6604
6604
  $rootScope.$digest();
6605
- expect(nodeName_(element)).toMatch(/tbody/i);
6605
+ expect(getNodeName(element)).toMatch(/tbody/i);
6606
6606
  });
6607
6607
 
6608
6608
  it("should support templates with root <tfoot> tags", () => {
@@ -6611,7 +6611,7 @@ describe("$compile", () => {
6611
6611
  element = $compile("<div replace-with-tfoot></div>")($rootScope);
6612
6612
  }).not.toThrow();
6613
6613
  $rootScope.$digest();
6614
- expect(nodeName_(element)).toMatch(/tfoot/i);
6614
+ expect(getNodeName(element)).toMatch(/tfoot/i);
6615
6615
  });
6616
6616
 
6617
6617
  it("should support templates with root <option> tags", () => {
@@ -6620,7 +6620,7 @@ describe("$compile", () => {
6620
6620
  element = $compile("<div replace-with-option></div>")($rootScope);
6621
6621
  }).not.toThrow();
6622
6622
  $rootScope.$digest();
6623
- expect(nodeName_(element)).toMatch(/option/i);
6623
+ expect(getNodeName(element)).toMatch(/option/i);
6624
6624
  });
6625
6625
 
6626
6626
  it("should support templates with root <optgroup> tags", () => {
@@ -6629,7 +6629,7 @@ describe("$compile", () => {
6629
6629
  element = $compile("<div replace-with-optgroup></div>")($rootScope);
6630
6630
  }).not.toThrow();
6631
6631
  $rootScope.$digest();
6632
- expect(nodeName_(element)).toMatch(/optgroup/i);
6632
+ expect(getNodeName(element)).toMatch(/optgroup/i);
6633
6633
  });
6634
6634
 
6635
6635
  it("should support SVG templates using directive.templateNamespace=svg", () => {
@@ -6656,7 +6656,7 @@ describe("$compile", () => {
6656
6656
  )($rootScope);
6657
6657
  $rootScope.$digest();
6658
6658
  const child = element.children().eq(0);
6659
- expect(nodeName_(child)).toMatch(/a/i);
6659
+ expect(getNodeName(child)).toMatch(/a/i);
6660
6660
  expect(isSVGElement(child[0])).toBe(true);
6661
6661
  expect(child[0].href.baseVal).toBe("/foo/bar");
6662
6662
  },
@@ -6692,7 +6692,7 @@ describe("$compile", () => {
6692
6692
  );
6693
6693
  $rootScope.$digest();
6694
6694
  const child = element.children().eq(0);
6695
- expect(nodeName_(child)).toMatch(/msup/i);
6695
+ expect(getNodeName(child)).toMatch(/msup/i);
6696
6696
  expect(isUnknownElement(child[0])).toBe(false);
6697
6697
  expect(isHTMLElement(child[0])).toBe(false);
6698
6698
  },
@@ -14789,10 +14789,10 @@ describe("$compile", () => {
14789
14789
  JQLite("<div>before<div transclude></div>after</div>")[0].childNodes,
14790
14790
  );
14791
14791
  expect(element.length).toEqual(3);
14792
- expect(nodeName_(element[1])).toBe("div");
14792
+ expect(getNodeName(element[1])).toBe("div");
14793
14793
  $compile(element)($rootScope);
14794
- expect(nodeName_(element[1])).toBe("#comment");
14795
- expect(nodeName_(comment)).toBe("#comment");
14794
+ expect(getNodeName(element[1])).toBe("#comment");
14795
+ expect(getNodeName(comment)).toBe("#comment");
14796
14796
  });
14797
14797
 
14798
14798
  it("should terminate compilation only for element transclusion", () => {
@@ -14973,7 +14973,7 @@ describe("$compile", () => {
14973
14973
  .directive("innerAgain", () => ({
14974
14974
  transclude: true,
14975
14975
  link(scope, element, attr, controllers, transclude) {
14976
- log.push(`innerAgain:${nodeName_(element)}`);
14976
+ log.push(`innerAgain:${getNodeName(element)}`);
14977
14977
  transclude(scope, (clone) => {
14978
14978
  element.parent().append(clone);
14979
14979
  });
@@ -14983,13 +14983,13 @@ describe("$compile", () => {
14983
14983
  replace: true,
14984
14984
  templateUrl: "inner.html",
14985
14985
  link(scope, element) {
14986
- log.push(`inner:${nodeName_(element)}`);
14986
+ log.push(`inner:${getNodeName(element)}`);
14987
14987
  },
14988
14988
  }))
14989
14989
  .directive("outer", () => ({
14990
14990
  transclude: true,
14991
14991
  link(scope, element, attrs, controllers, transclude) {
14992
- log.push(`outer:${nodeName_(element)}`);
14992
+ log.push(`outer:${getNodeName(element)}`);
14993
14993
  transclude(scope, (clone) => {
14994
14994
  element.parent().append(clone);
14995
14995
  });
@@ -1,4 +1,4 @@
1
- import { forEach, isObject } from "../../shared/utils";
1
+ import { isObject } from "../../shared/utils";
2
2
  import { filterFilter } from "../../filters/filter";
3
3
  import { jsonFilter } from "../../filters/filters";
4
4
  import { limitToFilter } from "../../filters/limit-to";
@@ -11,7 +11,7 @@ export function $FilterProvider($provide) {
11
11
  function register(name, factory) {
12
12
  if (isObject(name)) {
13
13
  const filters = {};
14
- forEach(name, (filter, key) => {
14
+ Object.entries(name).forEach(([key, filter]) => {
15
15
  filters[key] = register(key, filter);
16
16
  });
17
17
  return filters;
@@ -583,7 +583,7 @@ const locationPrototype = {
583
583
  } else if (isObject(search)) {
584
584
  search = structuredClone(search, {});
585
585
  // remove object undefined or null properties
586
- forEach(search, (value, key) => {
586
+ Object.entries(search).forEach(([key, value]) => {
587
587
  if (value == null) delete search[key];
588
588
  });
589
589
 
@@ -778,7 +778,7 @@ function findConstantAndWatchExpressions(ast, $filter, parentIsPure) {
778
778
  switch (ast.type) {
779
779
  case ASTType.Program:
780
780
  allConstants = true;
781
- forEach(ast.body, (expr) => {
781
+ /** @type {[any]} */ (ast.body).forEach((expr) => {
782
782
  findConstantAndWatchExpressions(expr.expression, $filter, astIsPure);
783
783
  allConstants = allConstants && expr.expression.constant;
784
784
  });
@@ -1,194 +1,13 @@
1
1
  import { BOOLEAN_ATTR } from "../../shared/jqlite/jqlite";
2
- import { forEach, directiveNormalize } from "../../shared/utils";
2
+ import { directiveNormalize } from "../../shared/utils";
3
3
  import { ALIASED_ATTR } from "../../shared/constants";
4
4
 
5
- /**
6
- * @ngdoc directive
7
- * @name ngHref
8
- * @restrict A
9
- * @priority 99
10
- *
11
- * @description
12
- * Using AngularJS markup like `{{hash}}` in an href attribute will
13
- * make the link go to the wrong URL if the user clicks it before
14
- * AngularJS has a chance to replace the `{{hash}}` markup with its
15
- * value. Until AngularJS replaces the markup the link will be broken
16
- * and will most likely return a 404 error. The `ngHref` directive
17
- * solves this problem.
18
- *
19
- * The wrong way to write it:
20
- * ```html
21
- * <a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
22
- * ```
23
- *
24
- * The correct way to write it:
25
- * ```html
26
- * <a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
27
- * ```
28
- *
29
- * @element A
30
- * @param {template} ngHref any string which can contain `{{}}` markup.
31
- *
32
- */
33
-
34
5
  export const REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
35
- /**
36
- * @ngdoc directive
37
- * @name ngSrc
38
- * @restrict A
39
- * @priority 99
40
- *
41
- * @description
42
- * Using AngularJS markup like `{{hash}}` in a `src` attribute doesn't
43
- * work right: The browser will fetch from the URL with the literal
44
- * text `{{hash}}` until AngularJS replaces the expression inside
45
- * `{{hash}}`. The `ngSrc` directive solves this problem.
46
- *
47
- * The buggy way to write it:
48
- * ```html
49
- * <img src="http://www.gravatar.com/avatar/{{hash}}" alt="Description"/>
50
- * ```
51
- *
52
- * The correct way to write it:
53
- * ```html
54
- * <img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
55
- * ```
56
- *
57
- * @element IMG
58
- * @param {template} ngSrc any string which can contain `{{}}` markup.
59
- */
60
-
61
- /**
62
- * @ngdoc directive
63
- * @name ngSrcset
64
- * @restrict A
65
- * @priority 99
66
- *
67
- * @description
68
- * Using AngularJS markup like `{{hash}}` in a `srcset` attribute doesn't
69
- * work right: The browser will fetch from the URL with the literal
70
- * text `{{hash}}` until AngularJS replaces the expression inside
71
- * `{{hash}}`. The `ngSrcset` directive solves this problem.
72
- *
73
- * The buggy way to write it:
74
- * ```html
75
- * <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description"/>
76
- * ```
77
- *
78
- * The correct way to write it:
79
- * ```html
80
- * <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description" />
81
- * ```
82
- *
83
- * @element IMG
84
- * @param {template} ngSrcset any string which can contain `{{}}` markup.
85
- */
86
-
87
- /**
88
- * @ngdoc directive
89
- * @name ngDisabled
90
- * @restrict A
91
- * @priority 100
92
- *
93
- * @description
94
- *
95
- * This directive sets the `disabled` attribute on the element (typically a form control,
96
- * e.g. `input`, `button`, `select` etc.) if the
97
- * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
98
- *
99
- * A special directive is necessary because we cannot use interpolation inside the `disabled`
100
- * attribute. See the {@link guide/interpolation interpolation guide} for more info.
101
- *
102
- * @param {string} ngDisabled If the {@link guide/expression expression} is truthy,
103
- * then the `disabled` attribute will be set on the element
104
- */
105
-
106
- /**
107
- * @ngdoc directive
108
- * @name ngChecked
109
- * @restrict A
110
- * @priority 100
111
- *
112
- * @description
113
- * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.
114
- *
115
- * Note that this directive should not be used together with {@link ngModel `ngModel`},
116
- * as this can lead to unexpected behavior.
117
- *
118
- * A special directive is necessary because we cannot use interpolation inside the `checked`
119
- * attribute. See the {@link guide/interpolation interpolation guide} for more info.
120
- *
121
- * @element INPUT
122
- * @param {string} ngChecked If the {@link guide/expression expression} is truthy,
123
- * then the `checked` attribute will be set on the element
124
- */
125
-
126
- /**
127
- *
128
- * @description
129
- *
130
- * Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy.
131
- * Note that `readonly` applies only to `input` elements with specific types. [See the input docs on
132
- * MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information.
133
- *
134
- * A special directive is necessary because we cannot use interpolation inside the `readonly`
135
- * attribute. See the {@link guide/interpolation interpolation guide} for more info.
136
- * @element INPUT
137
- * @param {string} ngReadonly If the {@link guide/expression expression} is truthy,
138
- * then special attribute "readonly" will be set on the element
139
- */
140
-
141
- /**
142
- * @ngdoc directive
143
- * @name ngSelected
144
- * @restrict A
145
- * @priority 100
146
- *
147
- * @description
148
- *
149
- * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.
150
- *
151
- * A special directive is necessary because we cannot use interpolation inside the `selected`
152
- * attribute. See the {@link guide/interpolation interpolation guide} for more info.
153
- *
154
- * <div class="alert alert-warning">
155
- * **Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only
156
- * sets the `selected` attribute on the element. If you are using `ngModel` on the select, you
157
- * should not use `ngSelected` on the options, as `ngModel` will set the select value and
158
- * selected options.
159
- * </div>
160
- * @element OPTION
161
- * @param {string} ngSelected If the {@link guide/expression expression} is truthy,
162
- * then special attribute "selected" will be set on the element
163
- */
164
-
165
- /**
166
- * @ngdoc directive
167
- * @name ngOpen
168
- * @restrict A
169
- * @priority 100
170
- *
171
- * @description
172
- *
173
- * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.
174
- *
175
- * A special directive is necessary because we cannot use interpolation inside the `open`
176
- * attribute. See the {@link guide/interpolation interpolation guide} for more info.
177
- *
178
- * ## A note about browser compatibility
179
- *
180
- * Internet Explorer and Edge do not support the `details` element, it is
181
- * recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead.
182
- *
183
- * @element DETAILS
184
- * @param {string} ngOpen If the {@link guide/expression expression} is truthy,
185
- * then special attribute "open" will be set on the element
186
- */
187
6
 
188
7
  export const ngAttributeAliasDirectives = {};
189
8
 
190
9
  // boolean attrs are evaluated
191
- forEach(BOOLEAN_ATTR, (propName, attrName) => {
10
+ Object.entries(BOOLEAN_ATTR).forEach(([attrName, propName]) => {
192
11
  // binding to multiple is not supported
193
12
  if (propName === "multiple") return;
194
13
 
@@ -220,7 +39,7 @@ forEach(BOOLEAN_ATTR, (propName, attrName) => {
220
39
  });
221
40
 
222
41
  // aliased input attrs are evaluated
223
- forEach(ALIASED_ATTR, (htmlAttr, ngAttr) => {
42
+ Object.entries(ALIASED_ATTR).forEach(([ngAttr]) => {
224
43
  ngAttributeAliasDirectives[ngAttr] = function () {
225
44
  return {
226
45
  priority: 100,
@@ -244,7 +63,7 @@ forEach(ALIASED_ATTR, (htmlAttr, ngAttr) => {
244
63
  });
245
64
 
246
65
  // ng-src, ng-srcset, ng-href are interpolated
247
- forEach(["src", "srcset", "href"], (attrName) => {
66
+ ["src", "srcset", "href"].forEach((attrName) => {
248
67
  const normalized = directiveNormalize(`ng-${attrName}`);
249
68
  ngAttributeAliasDirectives[normalized] = [
250
69
  "$sce",