@angular-wave/angular.ts 0.0.8 → 0.0.10
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/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/package.json +2 -3
- package/rollup.config.js +2 -5
- package/src/core/compile.js +73 -109
- package/src/core/root-scope.js +1 -1
- package/src/directive/if.js +2 -7
- package/src/directive/repeat.js +5 -346
- package/src/directive/repeat.md +358 -0
- package/src/directive/switch.js +2 -4
- package/src/exts/messages.js +2 -494
- package/src/exts/messages.md +550 -0
- package/src/injector.md +1 -1
- package/src/jqLite.js +14 -18
- package/src/loader.js +0 -4
- package/test/binding.spec.js +24 -24
- package/test/jqlite.spec.js +0 -56
- package/test/messages/messages.spec.js +2 -4
- package/test/module-test.html +5 -1
- package/test/ng/compile.spec.js +76 -164
- package/test/ng/directive/form.spec.js +1 -1
- package/test/ng/directive/if.spec.js +2 -1
- package/test/ng/directive/include.spec.js +3 -3
- package/test/ng/directive/repeat.spec.js +0 -37
- package/test/ng/directive/switch.spec.js +10 -20
- package/types/jqlite.d.ts +0 -78
- package/dist/angular-ts.cjs.js +0 -1
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-wave/angular.ts",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.10",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/angular-ts.
|
|
7
|
-
"module": "dist/angular-ts.esm.js",
|
|
6
|
+
"main": "dist/angular-ts.esm.js",
|
|
8
7
|
"browser": "dist/angular-ts.umd.js",
|
|
9
8
|
"repository": {
|
|
10
9
|
"type": "git",
|
package/rollup.config.js
CHANGED
|
@@ -15,7 +15,7 @@ export default [
|
|
|
15
15
|
plugins: [resolve(), commonjs(), terser()],
|
|
16
16
|
},
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// ES module (for bundlers) build.
|
|
19
19
|
// (We could have three entries in the configuration array
|
|
20
20
|
// instead of two, but it's quicker to generate multiple
|
|
21
21
|
// builds from a single configuration where possible, using
|
|
@@ -24,10 +24,7 @@ export default [
|
|
|
24
24
|
{
|
|
25
25
|
input: 'src/index.js',
|
|
26
26
|
external: ['ms'],
|
|
27
|
-
output:
|
|
28
|
-
{ file: pkg.main, format: 'cjs' },
|
|
29
|
-
{ file: pkg.module, format: 'es' },
|
|
30
|
-
],
|
|
27
|
+
output: { file: pkg.main, format: 'es' },
|
|
31
28
|
plugins: [terser()],
|
|
32
29
|
},
|
|
33
30
|
];
|
package/src/core/compile.js
CHANGED
|
@@ -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
|
-
|
|
43
|
-
|
|
44
|
-
let config = { TTL: 10 };
|
|
47
|
+
const _UNINITIALIZED_VALUE = new Object();
|
|
48
|
+
let TTL = 10;
|
|
45
49
|
|
|
46
50
|
/**
|
|
47
51
|
* @ngdoc provider
|
|
@@ -54,7 +58,6 @@ $CompileProvider.$inject = ["$provide", "$$sanitizeUriProvider"];
|
|
|
54
58
|
export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
55
59
|
const hasDirectives = {};
|
|
56
60
|
const Suffix = "Directive";
|
|
57
|
-
const CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/;
|
|
58
61
|
const ALL_OR_NOTHING_ATTRS = {
|
|
59
62
|
ngSrc: true,
|
|
60
63
|
ngSrcset: true,
|
|
@@ -209,7 +212,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
209
212
|
* are the factories.
|
|
210
213
|
* @param {Function|Array} directiveFactory An injectable directive factory function. See the
|
|
211
214
|
* {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
|
|
212
|
-
* @returns {ng
|
|
215
|
+
* @returns {ng.ICompileProvider} Self for chaining.
|
|
213
216
|
*/
|
|
214
217
|
this.directive = function registerDirective(name, directiveFactory) {
|
|
215
218
|
assertArg(name, "name");
|
|
@@ -252,7 +255,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
252
255
|
}
|
|
253
256
|
hasDirectives[name].push(directiveFactory);
|
|
254
257
|
} else {
|
|
255
|
-
forEach(
|
|
258
|
+
Object.entries(name).forEach(([k, v]) => registerDirective(k, v));
|
|
256
259
|
}
|
|
257
260
|
return this;
|
|
258
261
|
};
|
|
@@ -427,7 +430,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
427
430
|
* the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
|
|
428
431
|
*
|
|
429
432
|
* @param {RegExp=} regexp New regexp to trust urls with.
|
|
430
|
-
* @returns {RegExp|ng
|
|
433
|
+
* @returns {RegExp|ng.ICompileProvider} Current RegExp if called without value or self for
|
|
431
434
|
* chaining otherwise.
|
|
432
435
|
*/
|
|
433
436
|
this.aHrefSanitizationTrustedUrlList = function (regexp) {
|
|
@@ -455,7 +458,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
455
458
|
* the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
|
|
456
459
|
*
|
|
457
460
|
* @param {RegExp=} regexp New regexp to trust urls with.
|
|
458
|
-
* @returns {RegExp|ng
|
|
461
|
+
* @returns {RegExp|ng.ICompileProvider} Current RegExp if called without value or self for
|
|
459
462
|
* chaining otherwise.
|
|
460
463
|
*/
|
|
461
464
|
this.imgSrcSanitizationTrustedUrlList = function (regexp) {
|
|
@@ -528,34 +531,6 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
528
531
|
return strictComponentBindingsEnabled;
|
|
529
532
|
};
|
|
530
533
|
|
|
531
|
-
/**
|
|
532
|
-
* @ngdoc method
|
|
533
|
-
* @name $compileProvider#onChangesTtl
|
|
534
|
-
* @description
|
|
535
|
-
*
|
|
536
|
-
* Sets the number of times `$onChanges` hooks can trigger new changes before giving up and
|
|
537
|
-
* assuming that the model is unstable.
|
|
538
|
-
*
|
|
539
|
-
* The current default is 10 iterations.
|
|
540
|
-
*
|
|
541
|
-
* In complex applications it's possible that dependencies between `$onChanges` hooks and bindings will result
|
|
542
|
-
* in several iterations of calls to these hooks. However if an application needs more than the default 10
|
|
543
|
-
* iterations to stabilize then you should investigate what is causing the model to continuously change during
|
|
544
|
-
* the `$onChanges` hook execution.
|
|
545
|
-
*
|
|
546
|
-
* Increasing the TTL could have performance implications, so you should not change it without proper justification.
|
|
547
|
-
*
|
|
548
|
-
* @param {number} limit The number of `$onChanges` hook iterations.
|
|
549
|
-
* @returns {number|object} the current limit (or `this` if called as a setter for chaining)
|
|
550
|
-
*/
|
|
551
|
-
this.onChangesTtl = function (value) {
|
|
552
|
-
if (arguments.length) {
|
|
553
|
-
config.TTL = value;
|
|
554
|
-
return this;
|
|
555
|
-
}
|
|
556
|
-
return config.TTL;
|
|
557
|
-
};
|
|
558
|
-
|
|
559
534
|
/**
|
|
560
535
|
* The security context of DOM Properties.
|
|
561
536
|
* @private
|
|
@@ -686,13 +661,13 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
686
661
|
// This function is called in a $$postDigest to trigger all the onChanges hooks in a single digest
|
|
687
662
|
function flushOnChangesQueue() {
|
|
688
663
|
try {
|
|
689
|
-
if (!--
|
|
664
|
+
if (!--TTL) {
|
|
690
665
|
// We have hit the TTL limit so reset everything
|
|
691
666
|
onChangesQueue = undefined;
|
|
692
667
|
throw $compileMinErr(
|
|
693
668
|
"infchng",
|
|
694
669
|
"{0} $onChanges() iterations reached. Aborting!\n",
|
|
695
|
-
|
|
670
|
+
TTL,
|
|
696
671
|
);
|
|
697
672
|
}
|
|
698
673
|
// We must run this hook in an apply since the $$postDigest runs outside apply
|
|
@@ -708,7 +683,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
708
683
|
onChangesQueue = undefined;
|
|
709
684
|
});
|
|
710
685
|
} finally {
|
|
711
|
-
|
|
686
|
+
TTL++;
|
|
712
687
|
}
|
|
713
688
|
}
|
|
714
689
|
|
|
@@ -767,25 +742,20 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
767
742
|
return result;
|
|
768
743
|
}
|
|
769
744
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
this
|
|
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 = {};
|
|
780
755
|
}
|
|
781
|
-
|
|
782
|
-
this.$attr = {};
|
|
756
|
+
this.$$element = element;
|
|
783
757
|
}
|
|
784
758
|
|
|
785
|
-
this.$$element = element;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
Attributes.prototype = {
|
|
789
759
|
/**
|
|
790
760
|
* @ngdoc method
|
|
791
761
|
* @name $compile.directive.Attributes#$normalize
|
|
@@ -801,7 +771,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
801
771
|
*
|
|
802
772
|
* @param {string} name Name to normalize
|
|
803
773
|
*/
|
|
804
|
-
$normalize
|
|
774
|
+
$normalize = directiveNormalize;
|
|
805
775
|
|
|
806
776
|
/**
|
|
807
777
|
* @ngdoc method
|
|
@@ -818,7 +788,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
818
788
|
if (classVal && classVal.length > 0) {
|
|
819
789
|
$animate.addClass(this.$$element, classVal);
|
|
820
790
|
}
|
|
821
|
-
}
|
|
791
|
+
}
|
|
822
792
|
|
|
823
793
|
/**
|
|
824
794
|
* @ngdoc method
|
|
@@ -835,7 +805,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
835
805
|
if (classVal && classVal.length > 0) {
|
|
836
806
|
$animate.removeClass(this.$$element, classVal);
|
|
837
807
|
}
|
|
838
|
-
}
|
|
808
|
+
}
|
|
839
809
|
|
|
840
810
|
/**
|
|
841
811
|
* @ngdoc method
|
|
@@ -859,7 +829,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
859
829
|
if (toRemove && toRemove.length) {
|
|
860
830
|
$animate.removeClass(this.$$element, toRemove);
|
|
861
831
|
}
|
|
862
|
-
}
|
|
832
|
+
}
|
|
863
833
|
|
|
864
834
|
/**
|
|
865
835
|
* Set a normalized attribute on the element in a way such that all directives
|
|
@@ -910,6 +880,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
910
880
|
if (writeAttr !== false) {
|
|
911
881
|
if (value === null || isUndefined(value)) {
|
|
912
882
|
this.$$element[0].removeAttribute(attrName);
|
|
883
|
+
//
|
|
913
884
|
} else if (SIMPLE_ATTR_NAME.test(attrName)) {
|
|
914
885
|
// jQuery skips special boolean attrs treatment in XML nodes for
|
|
915
886
|
// historical reasons and hence AngularJS cannot freely call
|
|
@@ -937,7 +908,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
937
908
|
}
|
|
938
909
|
});
|
|
939
910
|
}
|
|
940
|
-
}
|
|
911
|
+
}
|
|
941
912
|
|
|
942
913
|
/**
|
|
943
914
|
* @ngdoc method
|
|
@@ -959,28 +930,27 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
959
930
|
* @returns {function()} Returns a deregistration function for this observer.
|
|
960
931
|
*/
|
|
961
932
|
$observe(key, fn) {
|
|
962
|
-
const attrs = this;
|
|
963
933
|
const $$observers =
|
|
964
|
-
|
|
934
|
+
this.$$observers || (this.$$observers = createMap());
|
|
965
935
|
const listeners = $$observers[key] || ($$observers[key] = []);
|
|
966
936
|
|
|
967
937
|
listeners.push(fn);
|
|
968
938
|
$rootScope.$evalAsync(() => {
|
|
969
939
|
if (
|
|
970
940
|
!listeners.$$inter &&
|
|
971
|
-
Object.prototype.hasOwnProperty.call(
|
|
972
|
-
!isUndefined(
|
|
941
|
+
Object.prototype.hasOwnProperty.call(this, key) &&
|
|
942
|
+
!isUndefined(this[key])
|
|
973
943
|
) {
|
|
974
944
|
// no one registered attribute interpolation function, so lets call it manually
|
|
975
|
-
fn(
|
|
945
|
+
fn(this[key]);
|
|
976
946
|
}
|
|
977
947
|
});
|
|
978
948
|
|
|
979
949
|
return function () {
|
|
980
950
|
arrayRemove(listeners, fn);
|
|
981
951
|
};
|
|
982
|
-
}
|
|
983
|
-
}
|
|
952
|
+
}
|
|
953
|
+
}
|
|
984
954
|
|
|
985
955
|
function setSpecialAttr(element, attrName, value) {
|
|
986
956
|
// Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute`
|
|
@@ -995,15 +965,6 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
995
965
|
element.attributes.setNamedItem(attribute);
|
|
996
966
|
}
|
|
997
967
|
|
|
998
|
-
function safeAddClass($element, className) {
|
|
999
|
-
try {
|
|
1000
|
-
$element[0].classList.add(className);
|
|
1001
|
-
} catch (e) {
|
|
1002
|
-
// ignore, since it means that we are trying to set class on
|
|
1003
|
-
// SVG element, where class name is read-only.
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
968
|
const startSymbol = $interpolate.startSymbol();
|
|
1008
969
|
const endSymbol = $interpolate.endSymbol();
|
|
1009
970
|
const denormalizeTemplate =
|
|
@@ -1018,7 +979,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1018
979
|
const MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;
|
|
1019
980
|
|
|
1020
981
|
compile.$$addScopeInfo = debugInfoEnabled
|
|
1021
|
-
?
|
|
982
|
+
? ($element, scope, isolated, noTemplate) => {
|
|
1022
983
|
const dataName = isolated
|
|
1023
984
|
? noTemplate
|
|
1024
985
|
? "$isolateScopeNoTemplate"
|
|
@@ -1028,19 +989,19 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1028
989
|
}
|
|
1029
990
|
: () => {};
|
|
1030
991
|
|
|
1031
|
-
compile.$$createComment = function (directiveName, comment) {
|
|
1032
|
-
let content = "";
|
|
1033
|
-
if (debugInfoEnabled) {
|
|
1034
|
-
content = ` ${directiveName || ""}: `;
|
|
1035
|
-
if (comment) content += `${comment} `;
|
|
1036
|
-
}
|
|
1037
|
-
return window.document.createComment(content);
|
|
1038
|
-
};
|
|
1039
|
-
|
|
1040
992
|
return compile;
|
|
1041
993
|
|
|
1042
994
|
//= ===============================
|
|
1043
995
|
|
|
996
|
+
/**
|
|
997
|
+
*
|
|
998
|
+
* @param {string|NodeList} $compileNodes
|
|
999
|
+
* @param {*} transcludeFn
|
|
1000
|
+
* @param {*} maxPriority
|
|
1001
|
+
* @param {*} ignoreDirective
|
|
1002
|
+
* @param {*} previousCompileContext
|
|
1003
|
+
* @returns
|
|
1004
|
+
*/
|
|
1044
1005
|
function compile(
|
|
1045
1006
|
$compileNodes,
|
|
1046
1007
|
transcludeFn,
|
|
@@ -1051,8 +1012,13 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1051
1012
|
if (!($compileNodes instanceof jqLite)) {
|
|
1052
1013
|
// jquery always rewraps, whereas we need to preserve the original selector so that we can
|
|
1053
1014
|
// modify it.
|
|
1015
|
+
|
|
1054
1016
|
$compileNodes = jqLite($compileNodes);
|
|
1055
1017
|
}
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* @type {CompositeLinkFn}
|
|
1021
|
+
*/
|
|
1056
1022
|
let compositeLinkFn = compileNodes(
|
|
1057
1023
|
$compileNodes,
|
|
1058
1024
|
transcludeFn,
|
|
@@ -1081,9 +1047,11 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1081
1047
|
}
|
|
1082
1048
|
|
|
1083
1049
|
options = options || {};
|
|
1084
|
-
let {
|
|
1085
|
-
|
|
1086
|
-
|
|
1050
|
+
let {
|
|
1051
|
+
transcludeControllers,
|
|
1052
|
+
parentBoundTranscludeFn,
|
|
1053
|
+
futureParentElement,
|
|
1054
|
+
} = options;
|
|
1087
1055
|
|
|
1088
1056
|
// When `parentBoundTranscludeFn` is passed, it is a
|
|
1089
1057
|
// `controllersBoundTransclude` function (it was previously passed
|
|
@@ -1130,9 +1098,6 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1130
1098
|
);
|
|
1131
1099
|
}
|
|
1132
1100
|
}
|
|
1133
|
-
|
|
1134
|
-
compile.$$addScopeInfo($linkNode, scope);
|
|
1135
|
-
|
|
1136
1101
|
if (cloneConnectFn) cloneConnectFn($linkNode, scope);
|
|
1137
1102
|
if (compositeLinkFn)
|
|
1138
1103
|
compositeLinkFn(
|
|
@@ -1168,7 +1133,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1168
1133
|
* function, which is the a linking function for the node.
|
|
1169
1134
|
*
|
|
1170
1135
|
* @param {NodeList} nodeList an array of nodes or NodeList to compile
|
|
1171
|
-
* @param {function(
|
|
1136
|
+
* @param {function(ng.IScope, cloneAttachFn=)} transcludeFn A linking function, where the
|
|
1172
1137
|
* scope argument is auto-generated to the new child of the transcluded parent scope.
|
|
1173
1138
|
* @param {Element=} $rootElement If the nodeList is the root of the compilation tree then
|
|
1174
1139
|
* the rootElement must be set the jqLite collection of the compile root. This is
|
|
@@ -1268,8 +1233,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1268
1233
|
if (nodeLinkFnFound) {
|
|
1269
1234
|
// copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our
|
|
1270
1235
|
// offsets don't get screwed up
|
|
1271
|
-
|
|
1272
|
-
stableNodeList = new Array(nodeListLength);
|
|
1236
|
+
stableNodeList = new Array(nodeList.length);
|
|
1273
1237
|
|
|
1274
1238
|
// create a sparse array by only copying the elements which have a linkFn
|
|
1275
1239
|
for (i = 0; i < linkFns.length; i += 3) {
|
|
@@ -1378,7 +1342,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1378
1342
|
* Looks for directives on the given node and adds them to the directive collection which is
|
|
1379
1343
|
* sorted.
|
|
1380
1344
|
*
|
|
1381
|
-
* @param node Node to search.
|
|
1345
|
+
* @param {Element} node Node to search.
|
|
1382
1346
|
* @param directives An array to which the directives are added to. This array is sorted before
|
|
1383
1347
|
* the function returns.
|
|
1384
1348
|
* @param attrs The shared attrs object which is used to populate the normalized attributes.
|
|
@@ -1393,9 +1357,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1393
1357
|
) {
|
|
1394
1358
|
const { nodeType } = node;
|
|
1395
1359
|
const attrsMap = attrs.$attr;
|
|
1396
|
-
let match;
|
|
1397
1360
|
let nodeName;
|
|
1398
|
-
let className;
|
|
1399
1361
|
|
|
1400
1362
|
switch (nodeType) {
|
|
1401
1363
|
case Node.ELEMENT_NODE /* Element */:
|
|
@@ -1528,9 +1490,9 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1528
1490
|
/**
|
|
1529
1491
|
* Given a node with a directive-start it collects all of the siblings until it finds
|
|
1530
1492
|
* directive-end.
|
|
1531
|
-
* @param node
|
|
1532
|
-
* @param attrStart
|
|
1533
|
-
* @param attrEnd
|
|
1493
|
+
* @param {Element} node
|
|
1494
|
+
* @param {string} attrStart
|
|
1495
|
+
* @param {string} attrEnd
|
|
1534
1496
|
* @returns {*}
|
|
1535
1497
|
*/
|
|
1536
1498
|
function groupScan(node, attrStart, attrEnd) {
|
|
@@ -1551,7 +1513,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1551
1513
|
if (node.hasAttribute(attrEnd)) depth--;
|
|
1552
1514
|
}
|
|
1553
1515
|
nodes.push(node);
|
|
1554
|
-
node = node.nextSibling;
|
|
1516
|
+
node = /** @type {Element} */ (node.nextSibling);
|
|
1555
1517
|
} while (depth > 0);
|
|
1556
1518
|
} else {
|
|
1557
1519
|
nodes.push(node);
|
|
@@ -1801,10 +1763,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1801
1763
|
terminalPriority = directive.priority;
|
|
1802
1764
|
$template = $compileNode;
|
|
1803
1765
|
$compileNode = templateAttrs.$$element = jqLite(
|
|
1804
|
-
|
|
1805
|
-
directiveName,
|
|
1806
|
-
templateAttrs[directiveName],
|
|
1807
|
-
),
|
|
1766
|
+
document.createComment(""),
|
|
1808
1767
|
);
|
|
1809
1768
|
compileNode = $compileNode[0];
|
|
1810
1769
|
replaceWith(jqCollection, sliceArgs($template), compileNode);
|
|
@@ -2528,8 +2487,6 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2528
2487
|
*
|
|
2529
2488
|
* * `E`: element name
|
|
2530
2489
|
* * `A': attribute
|
|
2531
|
-
* * `C`: class
|
|
2532
|
-
* * `M`: comment
|
|
2533
2490
|
* @returns {boolean} true if directive was added.
|
|
2534
2491
|
*/
|
|
2535
2492
|
function addDirective(
|
|
@@ -2782,7 +2739,14 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2782
2739
|
);
|
|
2783
2740
|
|
|
2784
2741
|
// Copy in CSS classes from original node
|
|
2785
|
-
|
|
2742
|
+
try {
|
|
2743
|
+
if (oldClasses !== "") {
|
|
2744
|
+
linkNode.classList.add(oldClasses);
|
|
2745
|
+
}
|
|
2746
|
+
} catch (e) {
|
|
2747
|
+
// ignore, since it means that we are trying to set class on
|
|
2748
|
+
// SVG element, where class name is read-only.
|
|
2749
|
+
}
|
|
2786
2750
|
}
|
|
2787
2751
|
if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
|
|
2788
2752
|
childBoundTranscludeFn = createBoundTranscludeFn(
|
package/src/core/root-scope.js
CHANGED
|
@@ -1044,7 +1044,7 @@ class Scope {
|
|
|
1044
1044
|
* Application code can register a `$destroy` event handler that will give it a chance to
|
|
1045
1045
|
* perform any necessary cleanup.
|
|
1046
1046
|
*
|
|
1047
|
-
* Note that, in AngularJS, there is also a `$destroy`
|
|
1047
|
+
* Note that, in AngularJS, there is also a `$destroy` event, which can be used to
|
|
1048
1048
|
* clean up DOM bindings before an element is removed from the DOM.
|
|
1049
1049
|
*/
|
|
1050
1050
|
$destroy() {
|
package/src/directive/if.js
CHANGED
|
@@ -80,8 +80,7 @@ import { getBlockNodes } from "../jqLite";
|
|
|
80
80
|
*/
|
|
81
81
|
export const ngIfDirective = [
|
|
82
82
|
"$animate",
|
|
83
|
-
|
|
84
|
-
($animate, $compile) => ({
|
|
83
|
+
($animate) => ({
|
|
85
84
|
multiElement: true,
|
|
86
85
|
transclude: "element",
|
|
87
86
|
priority: 600,
|
|
@@ -97,11 +96,7 @@ export const ngIfDirective = [
|
|
|
97
96
|
if (!childScope) {
|
|
98
97
|
$transclude((clone, newScope) => {
|
|
99
98
|
childScope = newScope;
|
|
100
|
-
|
|
101
|
-
clone[clone.length++] = $compile.$$createComment(
|
|
102
|
-
"end ngIf",
|
|
103
|
-
$attr.ngIf,
|
|
104
|
-
);
|
|
99
|
+
clone[clone.length++] = document.createComment("");
|
|
105
100
|
// Note: We only need the first/last node of the cloned nodes.
|
|
106
101
|
// However, we need to keep the reference to the jqlite wrapper as it might be changed later
|
|
107
102
|
// by a directive with templateUrl when its template arrives.
|