@angular-wave/angular.ts 0.0.7 → 0.0.9

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 (80) hide show
  1. package/dist/angular-ts.esm.js +1 -1
  2. package/dist/angular-ts.umd.js +1 -1
  3. package/docs/.cspell.yml +8 -0
  4. package/docs/.github/dependabot.yml +14 -0
  5. package/docs/.nvmrc +1 -0
  6. package/docs/CONTRIBUTING.md +28 -0
  7. package/docs/Dockerfile +4 -0
  8. package/docs/LICENSE +201 -0
  9. package/docs/README.md +184 -0
  10. package/docs/assets/scss/_variables_project.scss +6 -0
  11. package/docs/config.yaml +15 -0
  12. package/docs/content/en/_index.md +77 -0
  13. package/docs/content/en/about/featured-background.jpg +0 -0
  14. package/docs/content/en/about/index.md +35 -0
  15. package/docs/content/en/blog/_index.md +8 -0
  16. package/docs/content/en/blog/news/_index.md +4 -0
  17. package/docs/content/en/blog/news/first-post/featured-sunset-get.png +0 -0
  18. package/docs/content/en/blog/news/first-post/index.md +48 -0
  19. package/docs/content/en/blog/news/second-post.md +244 -0
  20. package/docs/content/en/blog/releases/_index.md +4 -0
  21. package/docs/content/en/blog/releases/in-depth-monoliths-detailed-spec.md +244 -0
  22. package/docs/content/en/community/_index.md +6 -0
  23. package/docs/content/en/docs/_index.md +29 -0
  24. package/docs/content/en/docs/concepts/_index.md +14 -0
  25. package/docs/content/en/docs/contribution-guidelines/_index.md +79 -0
  26. package/docs/content/en/docs/examples/_index.md +13 -0
  27. package/docs/content/en/docs/getting-started/_index.md +35 -0
  28. package/docs/content/en/docs/getting-started/example-page.md +240 -0
  29. package/docs/content/en/docs/overview/_index.md +36 -0
  30. package/docs/content/en/docs/reference/_index.md +12 -0
  31. package/docs/content/en/docs/reference/parameter-reference.md +211 -0
  32. package/docs/content/en/docs/tasks/Ponycopters/_index.md +12 -0
  33. package/docs/content/en/docs/tasks/Ponycopters/configuring-ponycopters.md +238 -0
  34. package/docs/content/en/docs/tasks/Ponycopters/launching-ponycopters.md +236 -0
  35. package/docs/content/en/docs/tasks/_index.md +21 -0
  36. package/docs/content/en/docs/tasks/beds.md +237 -0
  37. package/docs/content/en/docs/tasks/porridge.md +237 -0
  38. package/docs/content/en/docs/tasks/task.md +237 -0
  39. package/docs/content/en/docs/tutorials/_index.md +13 -0
  40. package/docs/content/en/docs/tutorials/multi-bear.md +236 -0
  41. package/docs/content/en/docs/tutorials/tutorial2.md +236 -0
  42. package/docs/content/en/featured-background.jpg +0 -0
  43. package/docs/content/en/search.md +4 -0
  44. package/docs/docker-compose.yaml +13 -0
  45. package/docs/docsy.work +5 -0
  46. package/docs/docsy.work.sum +0 -0
  47. package/docs/go.mod +5 -0
  48. package/docs/go.sum +6 -0
  49. package/docs/hugo-disabled.toml +221 -0
  50. package/docs/hugo.yaml +220 -0
  51. package/docs/layouts/404.html +7 -0
  52. package/docs/layouts/_default/_markup/render-heading.html +1 -0
  53. package/docs/netlify.toml +12 -0
  54. package/docs/package.json +42 -0
  55. package/package.json +1 -1
  56. package/rollup.config.js +2 -5
  57. package/src/core/compile.js +82 -269
  58. package/src/core/compile.md +51 -16
  59. package/src/core/filter.md +23 -17
  60. package/src/core/interval.md +73 -72
  61. package/src/core/sce.js +2 -13
  62. package/src/directive/if.js +2 -7
  63. package/src/directive/repeat.js +5 -346
  64. package/src/directive/repeat.md +358 -0
  65. package/src/directive/switch.js +2 -4
  66. package/src/exts/messages.js +2 -494
  67. package/src/exts/messages.md +550 -0
  68. package/src/injector.md +30 -1
  69. package/src/jqLite.js +11 -17
  70. package/src/loader.js +0 -4
  71. package/test/binding.spec.js +24 -24
  72. package/test/jqlite.spec.js +0 -56
  73. package/test/messages/messages.spec.js +3 -5
  74. package/test/module-test.html +5 -1
  75. package/test/ng/compile.spec.js +94 -371
  76. package/test/ng/directive/form.spec.js +8 -8
  77. package/test/ng/directive/repeat.spec.js +0 -37
  78. package/test/ng/directive/switch.spec.js +2 -9
  79. package/types/jqlite.d.ts +0 -78
  80. package/dist/angular-ts.cjs.js +0 -1
@@ -37,11 +37,15 @@ import { PREFIX_REGEXP, ALIASED_ATTR } from "../constants";
37
37
  import { createEventDirective } from "../directive/events";
38
38
  import { CACHE, EXPANDO } from "./cache";
39
39
 
40
+ /**
41
+ * Function that aggregates all linking fns for a compilation root (nodeList)
42
+ * @typedef {Function} CompositeLinkFn
43
+ */
44
+
40
45
  const $compileMinErr = minErr("$compile");
41
46
 
42
- function UNINITIALIZED_VALUE() {}
43
- const _UNINITIALIZED_VALUE = new UNINITIALIZED_VALUE();
44
- let config = { TTL: 10 };
47
+ const _UNINITIALIZED_VALUE = new Object();
48
+ let TTL = 10;
45
49
 
46
50
  /**
47
51
  * @ngdoc provider
@@ -49,14 +53,11 @@ let config = { TTL: 10 };
49
53
  *
50
54
  * @description
51
55
  */
52
- // eslint-disable-next-line no-use-before-define
53
56
  $CompileProvider.$inject = ["$provide", "$$sanitizeUriProvider"];
54
57
 
55
58
  export function $CompileProvider($provide, $$sanitizeUriProvider) {
56
59
  const hasDirectives = {};
57
60
  const Suffix = "Directive";
58
- const COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/;
59
- const CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/;
60
61
  const ALL_OR_NOTHING_ATTRS = {
61
62
  ngSrc: true,
62
63
  ngSrcset: true,
@@ -211,7 +212,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
211
212
  * are the factories.
212
213
  * @param {Function|Array} directiveFactory An injectable directive factory function. See the
213
214
  * {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
214
- * @returns {ng.$compileProvider} Self for chaining.
215
+ * @returns {ng.ICompileProvider} Self for chaining.
215
216
  */
216
217
  this.directive = function registerDirective(name, directiveFactory) {
217
218
  assertArg(name, "name");
@@ -254,7 +255,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
254
255
  }
255
256
  hasDirectives[name].push(directiveFactory);
256
257
  } else {
257
- forEach(name, reverseParams(registerDirective));
258
+ Object.entries(name).forEach(([k, v]) => registerDirective(k, v));
258
259
  }
259
260
  return this;
260
261
  };
@@ -429,7 +430,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
429
430
  * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
430
431
  *
431
432
  * @param {RegExp=} regexp New regexp to trust urls with.
432
- * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
433
+ * @returns {RegExp|ng.ICompileProvider} Current RegExp if called without value or self for
433
434
  * chaining otherwise.
434
435
  */
435
436
  this.aHrefSanitizationTrustedUrlList = function (regexp) {
@@ -457,7 +458,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
457
458
  * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
458
459
  *
459
460
  * @param {RegExp=} regexp New regexp to trust urls with.
460
- * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
461
+ * @returns {RegExp|ng.ICompileProvider} Current RegExp if called without value or self for
461
462
  * chaining otherwise.
462
463
  */
463
464
  this.imgSrcSanitizationTrustedUrlList = function (regexp) {
@@ -530,90 +531,6 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
530
531
  return strictComponentBindingsEnabled;
531
532
  };
532
533
 
533
- /**
534
- * @ngdoc method
535
- * @name $compileProvider#onChangesTtl
536
- * @description
537
- *
538
- * Sets the number of times `$onChanges` hooks can trigger new changes before giving up and
539
- * assuming that the model is unstable.
540
- *
541
- * The current default is 10 iterations.
542
- *
543
- * In complex applications it's possible that dependencies between `$onChanges` hooks and bindings will result
544
- * in several iterations of calls to these hooks. However if an application needs more than the default 10
545
- * iterations to stabilize then you should investigate what is causing the model to continuously change during
546
- * the `$onChanges` hook execution.
547
- *
548
- * Increasing the TTL could have performance implications, so you should not change it without proper justification.
549
- *
550
- * @param {number} limit The number of `$onChanges` hook iterations.
551
- * @returns {number|object} the current limit (or `this` if called as a setter for chaining)
552
- */
553
- this.onChangesTtl = function (value) {
554
- if (arguments.length) {
555
- config.TTL = value;
556
- return this;
557
- }
558
- return config.TTL;
559
- };
560
-
561
- let commentDirectivesEnabledConfig = true;
562
- /**
563
- * @ngdoc method
564
- * @name $compileProvider#commentDirectivesEnabled
565
- * @description
566
- *
567
- * It indicates to the compiler
568
- * whether or not directives on comments should be compiled.
569
- * Defaults to `true`.
570
- *
571
- * Calling this function with false disables the compilation of directives
572
- * on comments for the whole application.
573
- * This results in a compilation performance gain,
574
- * as the compiler doesn't have to check comments when looking for directives.
575
- * This should however only be used if you are sure that no comment directives are used in
576
- * the application (including any 3rd party directives).
577
- *
578
- * @param {boolean} enabled `false` if the compiler may ignore directives on comments
579
- * @returns {boolean|object} the current value (or `this` if called as a setter for chaining)
580
- */
581
- this.commentDirectivesEnabled = function (value) {
582
- if (arguments.length) {
583
- commentDirectivesEnabledConfig = value;
584
- return this;
585
- }
586
- return commentDirectivesEnabledConfig;
587
- };
588
-
589
- let cssClassDirectivesEnabledConfig = true;
590
- /**
591
- * @ngdoc method
592
- * @name $compileProvider#cssClassDirectivesEnabled
593
- * @description
594
- *
595
- * It indicates to the compiler
596
- * whether or not directives on element classes should be compiled.
597
- * Defaults to `true`.
598
- *
599
- * Calling this function with false disables the compilation of directives
600
- * on element classes for the whole application.
601
- * This results in a compilation performance gain,
602
- * as the compiler doesn't have to check element classes when looking for directives.
603
- * This should however only be used if you are sure that no class directives are used in
604
- * the application (including any 3rd party directives).
605
- *
606
- * @param {boolean} enabled `false` if the compiler may ignore directives on element classes
607
- * @returns {boolean|object} the current value (or `this` if called as a setter for chaining)
608
- */
609
- this.cssClassDirectivesEnabled = function (value) {
610
- if (arguments.length) {
611
- cssClassDirectivesEnabledConfig = value;
612
- return this;
613
- }
614
- return cssClassDirectivesEnabledConfig;
615
- };
616
-
617
534
  /**
618
535
  * The security context of DOM Properties.
619
536
  * @private
@@ -737,9 +654,6 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
737
654
  const SIMPLE_ATTR_NAME = /^\w/;
738
655
  const specialAttrHolder = window.document.createElement("div");
739
656
 
740
- const commentDirectivesEnabled = commentDirectivesEnabledConfig;
741
- const cssClassDirectivesEnabled = cssClassDirectivesEnabledConfig;
742
-
743
657
  // The onChanges hooks should all be run together in a single digest
744
658
  // When changes occur, the call to trigger their hooks will be added to this queue
745
659
  let onChangesQueue;
@@ -747,13 +661,13 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
747
661
  // This function is called in a $$postDigest to trigger all the onChanges hooks in a single digest
748
662
  function flushOnChangesQueue() {
749
663
  try {
750
- if (!--config.TTL) {
664
+ if (!--TTL) {
751
665
  // We have hit the TTL limit so reset everything
752
666
  onChangesQueue = undefined;
753
667
  throw $compileMinErr(
754
668
  "infchng",
755
669
  "{0} $onChanges() iterations reached. Aborting!\n",
756
- config.TTL,
670
+ TTL,
757
671
  );
758
672
  }
759
673
  // We must run this hook in an apply since the $$postDigest runs outside apply
@@ -769,7 +683,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
769
683
  onChangesQueue = undefined;
770
684
  });
771
685
  } finally {
772
- config.TTL++;
686
+ TTL++;
773
687
  }
774
688
  }
775
689
 
@@ -828,25 +742,20 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
828
742
  return result;
829
743
  }
830
744
 
831
- function Attributes(element, attributesToCopy) {
832
- if (attributesToCopy) {
833
- const keys = Object.keys(attributesToCopy);
834
- let i;
835
- let l;
836
- let key;
837
-
838
- for (i = 0, l = keys.length; i < l; i++) {
839
- key = keys[i];
840
- this[key] = attributesToCopy[key];
745
+ class Attributes {
746
+ constructor(element, attributesToCopy) {
747
+ if (attributesToCopy) {
748
+ const keys = Object.keys(attributesToCopy);
749
+ for (let i = 0, l = keys.length; i < l; i++) {
750
+ const key = keys[i];
751
+ this[key] = attributesToCopy[key];
752
+ }
753
+ } else {
754
+ this.$attr = {};
841
755
  }
842
- } else {
843
- this.$attr = {};
756
+ this.$$element = element;
844
757
  }
845
758
 
846
- this.$$element = element;
847
- }
848
-
849
- Attributes.prototype = {
850
759
  /**
851
760
  * @ngdoc method
852
761
  * @name $compile.directive.Attributes#$normalize
@@ -862,7 +771,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
862
771
  *
863
772
  * @param {string} name Name to normalize
864
773
  */
865
- $normalize: directiveNormalize,
774
+ $normalize = directiveNormalize;
866
775
 
867
776
  /**
868
777
  * @ngdoc method
@@ -879,7 +788,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
879
788
  if (classVal && classVal.length > 0) {
880
789
  $animate.addClass(this.$$element, classVal);
881
790
  }
882
- },
791
+ }
883
792
 
884
793
  /**
885
794
  * @ngdoc method
@@ -896,7 +805,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
896
805
  if (classVal && classVal.length > 0) {
897
806
  $animate.removeClass(this.$$element, classVal);
898
807
  }
899
- },
808
+ }
900
809
 
901
810
  /**
902
811
  * @ngdoc method
@@ -920,7 +829,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
920
829
  if (toRemove && toRemove.length) {
921
830
  $animate.removeClass(this.$$element, toRemove);
922
831
  }
923
- },
832
+ }
924
833
 
925
834
  /**
926
835
  * Set a normalized attribute on the element in a way such that all directives
@@ -971,6 +880,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
971
880
  if (writeAttr !== false) {
972
881
  if (value === null || isUndefined(value)) {
973
882
  this.$$element[0].removeAttribute(attrName);
883
+ //
974
884
  } else if (SIMPLE_ATTR_NAME.test(attrName)) {
975
885
  // jQuery skips special boolean attrs treatment in XML nodes for
976
886
  // historical reasons and hence AngularJS cannot freely call
@@ -998,9 +908,9 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
998
908
  }
999
909
  });
1000
910
  }
1001
- },
911
+ }
1002
912
 
1003
- /**
913
+ /**
1004
914
  * @ngdoc method
1005
915
  * @name $compile.directive.Attributes#$observe
1006
916
  * @kind function
@@ -1020,28 +930,27 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1020
930
  * @returns {function()} Returns a deregistration function for this observer.
1021
931
  */
1022
932
  $observe(key, fn) {
1023
- const attrs = this;
1024
933
  const $$observers =
1025
- attrs.$$observers || (attrs.$$observers = createMap());
934
+ this.$$observers || (this.$$observers = createMap());
1026
935
  const listeners = $$observers[key] || ($$observers[key] = []);
1027
936
 
1028
937
  listeners.push(fn);
1029
938
  $rootScope.$evalAsync(() => {
1030
939
  if (
1031
940
  !listeners.$$inter &&
1032
- Object.prototype.hasOwnProperty.call(attrs, key) &&
1033
- !isUndefined(attrs[key])
941
+ Object.prototype.hasOwnProperty.call(this, key) &&
942
+ !isUndefined(this[key])
1034
943
  ) {
1035
944
  // no one registered attribute interpolation function, so lets call it manually
1036
- fn(attrs[key]);
945
+ fn(this[key]);
1037
946
  }
1038
947
  });
1039
948
 
1040
949
  return function () {
1041
950
  arrayRemove(listeners, fn);
1042
951
  };
1043
- },
1044
- };
952
+ }
953
+ }
1045
954
 
1046
955
  function setSpecialAttr(element, attrName, value) {
1047
956
  // Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute`
@@ -1056,15 +965,6 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1056
965
  element.attributes.setNamedItem(attribute);
1057
966
  }
1058
967
 
1059
- function safeAddClass($element, className) {
1060
- try {
1061
- $element[0].classList.add(className);
1062
- } catch (e) {
1063
- // ignore, since it means that we are trying to set class on
1064
- // SVG element, where class name is read-only.
1065
- }
1066
- }
1067
-
1068
968
  const startSymbol = $interpolate.startSymbol();
1069
969
  const endSymbol = $interpolate.endSymbol();
1070
970
  const denormalizeTemplate =
@@ -1079,7 +979,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1079
979
  const MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;
1080
980
 
1081
981
  compile.$$addScopeInfo = debugInfoEnabled
1082
- ? function $$addScopeInfo($element, scope, isolated, noTemplate) {
982
+ ? ($element, scope, isolated, noTemplate) => {
1083
983
  const dataName = isolated
1084
984
  ? noTemplate
1085
985
  ? "$isolateScopeNoTemplate"
@@ -1089,19 +989,19 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1089
989
  }
1090
990
  : () => {};
1091
991
 
1092
- compile.$$createComment = function (directiveName, comment) {
1093
- let content = "";
1094
- if (debugInfoEnabled) {
1095
- content = ` ${directiveName || ""}: `;
1096
- if (comment) content += `${comment} `;
1097
- }
1098
- return window.document.createComment(content);
1099
- };
1100
-
1101
992
  return compile;
1102
993
 
1103
994
  //= ===============================
1104
995
 
996
+ /**
997
+ *
998
+ * @param {string|NodeList} $compileNodes
999
+ * @param {*} transcludeFn
1000
+ * @param {*} maxPriority
1001
+ * @param {*} ignoreDirective
1002
+ * @param {*} previousCompileContext
1003
+ * @returns
1004
+ */
1105
1005
  function compile(
1106
1006
  $compileNodes,
1107
1007
  transcludeFn,
@@ -1112,8 +1012,13 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1112
1012
  if (!($compileNodes instanceof jqLite)) {
1113
1013
  // jquery always rewraps, whereas we need to preserve the original selector so that we can
1114
1014
  // modify it.
1015
+
1115
1016
  $compileNodes = jqLite($compileNodes);
1116
1017
  }
1018
+
1019
+ /**
1020
+ * @type {CompositeLinkFn}
1021
+ */
1117
1022
  let compositeLinkFn = compileNodes(
1118
1023
  $compileNodes,
1119
1024
  transcludeFn,
@@ -1229,7 +1134,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1229
1134
  * function, which is the a linking function for the node.
1230
1135
  *
1231
1136
  * @param {NodeList} nodeList an array of nodes or NodeList to compile
1232
- * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
1137
+ * @param {function(ng.IScope, cloneAttachFn=)} transcludeFn A linking function, where the
1233
1138
  * scope argument is auto-generated to the new child of the transcluded parent scope.
1234
1139
  * @param {Element=} $rootElement If the nodeList is the root of the compilation tree then
1235
1140
  * the rootElement must be set the jqLite collection of the compile root. This is
@@ -1329,8 +1234,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1329
1234
  if (nodeLinkFnFound) {
1330
1235
  // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our
1331
1236
  // offsets don't get screwed up
1332
- const nodeListLength = nodeList.length;
1333
- stableNodeList = new Array(nodeListLength);
1237
+ stableNodeList = new Array(nodeList.length);
1334
1238
 
1335
1239
  // create a sparse array by only copying the elements which have a linkFn
1336
1240
  for (i = 0; i < linkFns.length; i += 3) {
@@ -1439,7 +1343,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1439
1343
  * Looks for directives on the given node and adds them to the directive collection which is
1440
1344
  * sorted.
1441
1345
  *
1442
- * @param node Node to search.
1346
+ * @param {Element} node Node to search.
1443
1347
  * @param directives An array to which the directives are added to. This array is sorted before
1444
1348
  * the function returns.
1445
1349
  * @param attrs The shared attrs object which is used to populate the normalized attributes.
@@ -1454,9 +1358,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1454
1358
  ) {
1455
1359
  const { nodeType } = node;
1456
1360
  const attrsMap = attrs.$attr;
1457
- let match;
1458
1361
  let nodeName;
1459
- let className;
1460
1362
 
1461
1363
  switch (nodeType) {
1462
1364
  case Node.ELEMENT_NODE /* Element */:
@@ -1574,44 +1476,11 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1574
1476
  node.setAttribute("autocomplete", "off");
1575
1477
  }
1576
1478
 
1577
- // use class as directive
1578
- if (!cssClassDirectivesEnabled) break;
1579
- // TODO: migrate to classList
1580
- className = node.className;
1581
- if (isObject(className)) {
1582
- // Maybe SVGAnimatedString
1583
- className = className.animVal;
1584
- }
1585
- if (isString(className) && className !== "") {
1586
- while ((match = CLASS_DIRECTIVE_REGEXP.exec(className))) {
1587
- nName = directiveNormalize(match[2]);
1588
- if (
1589
- addDirective(
1590
- directives,
1591
- nName,
1592
- "C",
1593
- maxPriority,
1594
- ignoreDirective,
1595
- )
1596
- ) {
1597
- attrs[nName] = trim(match[3]);
1598
- }
1599
- className = className.substr(match.index + match[0].length);
1600
- }
1601
- }
1602
1479
  break;
1603
1480
  case Node.TEXT_NODE:
1604
1481
  addTextInterpolateDirective(directives, node.nodeValue);
1605
1482
  break;
1606
- case Node.COMMENT_NODE:
1607
- if (!commentDirectivesEnabled) break;
1608
- collectCommentDirectives(
1609
- node,
1610
- directives,
1611
- attrs,
1612
- maxPriority,
1613
- ignoreDirective,
1614
- );
1483
+ default:
1615
1484
  break;
1616
1485
  }
1617
1486
 
@@ -1619,38 +1488,12 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1619
1488
  return directives;
1620
1489
  }
1621
1490
 
1622
- function collectCommentDirectives(
1623
- node,
1624
- directives,
1625
- attrs,
1626
- maxPriority,
1627
- ignoreDirective,
1628
- ) {
1629
- // function created because of performance, try/catch disables
1630
- // the optimization of the whole function #14848
1631
- try {
1632
- const match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
1633
- if (match) {
1634
- const nName = directiveNormalize(match[1]);
1635
- if (
1636
- addDirective(directives, nName, "M", maxPriority, ignoreDirective)
1637
- ) {
1638
- attrs[nName] = trim(match[2]);
1639
- }
1640
- }
1641
- } catch (e) {
1642
- // turns out that under some circumstances IE9 throws errors when one attempts to read
1643
- // comment's node value.
1644
- // Just ignore it and continue. (Can't seem to reproduce in test case.)
1645
- }
1646
- }
1647
-
1648
1491
  /**
1649
1492
  * Given a node with a directive-start it collects all of the siblings until it finds
1650
1493
  * directive-end.
1651
- * @param node
1652
- * @param attrStart
1653
- * @param attrEnd
1494
+ * @param {Element} node
1495
+ * @param {string} attrStart
1496
+ * @param {string} attrEnd
1654
1497
  * @returns {*}
1655
1498
  */
1656
1499
  function groupScan(node, attrStart, attrEnd) {
@@ -1671,7 +1514,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1671
1514
  if (node.hasAttribute(attrEnd)) depth--;
1672
1515
  }
1673
1516
  nodes.push(node);
1674
- node = node.nextSibling;
1517
+ node = /** @type {Element} */ (node.nextSibling);
1675
1518
  } while (depth > 0);
1676
1519
  } else {
1677
1520
  nodes.push(node);
@@ -1921,10 +1764,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
1921
1764
  terminalPriority = directive.priority;
1922
1765
  $template = $compileNode;
1923
1766
  $compileNode = templateAttrs.$$element = jqLite(
1924
- compile.$$createComment(
1925
- directiveName,
1926
- templateAttrs[directiveName],
1927
- ),
1767
+ document.createComment(""),
1928
1768
  );
1929
1769
  compileNode = $compileNode[0];
1930
1770
  replaceWith(jqCollection, sliceArgs($template), compileNode);
@@ -2648,8 +2488,6 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
2648
2488
  *
2649
2489
  * * `E`: element name
2650
2490
  * * `A': attribute
2651
- * * `C`: class
2652
- * * `M`: comment
2653
2491
  * @returns {boolean} true if directive was added.
2654
2492
  */
2655
2493
  function addDirective(
@@ -2902,7 +2740,14 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
2902
2740
  );
2903
2741
 
2904
2742
  // Copy in CSS classes from original node
2905
- safeAddClass(jqLite(linkNode), oldClasses);
2743
+ try {
2744
+ if (oldClasses !== "") {
2745
+ linkNode.classList.add(oldClasses);
2746
+ }
2747
+ } catch (e) {
2748
+ // ignore, since it means that we are trying to set class on
2749
+ // SVG element, where class name is read-only.
2750
+ }
2906
2751
  }
2907
2752
  if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
2908
2753
  childBoundTranscludeFn = createBoundTranscludeFn(
@@ -3548,51 +3393,19 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
3548
3393
  ];
3549
3394
  }
3550
3395
 
3551
- function SimpleChange(previous, current) {
3552
- this.previousValue = previous;
3553
- this.currentValue = current;
3554
- }
3555
- SimpleChange.prototype.isFirstChange = function () {
3556
- return this.previousValue === _UNINITIALIZED_VALUE;
3557
- };
3558
-
3559
- /**
3560
- * @ngdoc type
3561
- * @name $compile.directive.Attributes
3562
- *
3563
- * @description
3564
- * A shared object between directive compile / linking functions which contains normalized DOM
3565
- * element attributes. The values reflect current binding state `{{ }}`. The normalization is
3566
- * needed since all of these are treated as equivalent in AngularJS:
3567
- *
3568
- * ```
3569
- * <span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a">
3570
- * ```
3571
- */
3572
-
3573
- /**
3574
- * @ngdoc property
3575
- * @name $compile.directive.Attributes#$attr
3576
- *
3577
- * @description
3578
- * A map of DOM element attribute names to the normalized name. This is
3579
- * needed to do reverse lookup from normalized name back to actual name.
3580
- */
3396
+ class SimpleChange {
3397
+ constructor(previous, current) {
3398
+ this.previousValue = previous;
3399
+ this.currentValue = current;
3400
+ }
3581
3401
 
3582
- /**
3583
- * @ngdoc method
3584
- * @name $compile.directive.Attributes#$set
3585
- * @kind function
3586
- *
3587
- * @description
3588
- * Set DOM element attribute value.
3589
- *
3590
- *
3591
- * @param {string} name Normalized element attribute name of the property to modify. The name is
3592
- * reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}
3593
- * property to the original name.
3594
- * @param {string} value Value to set the attribute to. The value can be an interpolated string.
3595
- */
3402
+ /**
3403
+ * @returns {boolean}
3404
+ */
3405
+ isFirstChange() {
3406
+ return this.previousValue === _UNINITIALIZED_VALUE;
3407
+ }
3408
+ }
3596
3409
 
3597
3410
  function tokenDifference(str1, str2) {
3598
3411
  let values = "";