@angular-wave/angular.ts 0.6.3 → 0.6.5
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 +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/angular.spec.js +2 -2
- package/src/animations/animate-children-directive.js +1 -1
- package/src/animations/animate-css-driver.js +2 -2
- package/src/animations/animate-css.js +1 -1
- package/src/animations/animate-js.js +2 -2
- package/src/animations/animate-queue.js +2 -2
- package/src/animations/animate.js +2 -2
- package/src/animations/animate.spec.js +3 -3
- package/src/animations/animation.js +3 -3
- package/src/binding.spec.js +1 -1
- package/src/core/cache/cache.js +1 -1
- package/src/core/compile/attributes.js +24 -7
- package/src/core/compile/compile.js +79 -249
- package/src/core/compile/compile.md +0 -8
- package/src/core/compile/compile.spec.js +38 -640
- package/src/core/controller/controller.js +2 -2
- package/src/core/di/injector.js +1 -1
- package/src/core/di/injector.spec.js +1 -1
- package/src/core/di/internal-injector.js +2 -2
- package/src/core/di/ng-module.js +1 -1
- package/src/core/filter/filter.js +2 -2
- package/src/core/interpolate/interpolate.js +1 -1
- package/src/core/interval/interval-factory.js +1 -1
- package/src/core/interval/interval.js +1 -1
- package/src/core/location/location.js +3 -3
- package/src/core/on.spec.js +1 -1
- package/src/core/parse/interpreter.js +1 -1
- package/src/core/prop.spec.js +2 -2
- package/src/core/q/q.js +2 -2
- package/src/core/root-element.spec.js +1 -1
- package/src/core/sanitize/sanitize-uri.js +1 -1
- package/src/core/sce/sce.js +3 -3
- package/src/core/sce/sce.spec.js +1 -1
- package/src/core/scope/scope.js +3 -3
- package/src/core/scope/scope.spec.js +1 -1
- package/src/core/timeout/timeout.js +2 -2
- package/src/core/url-utils/url-utils.js +1 -1
- package/src/directive/aria/aria.js +1 -1
- package/src/directive/aria/aria.spec.js +1 -1
- package/src/directive/attrs/attrs.js +3 -3
- package/src/directive/attrs/attrs.spec.js +1 -1
- package/src/directive/attrs/boolean.spec.js +1 -1
- package/src/directive/attrs/element-style.spec.js +1 -1
- package/src/directive/attrs/src.spec.js +1 -1
- package/src/directive/bind/bind.js +1 -1
- package/src/directive/bind/bind.spec.js +1 -1
- package/src/directive/bind/bing-html.spec.js +1 -1
- package/src/directive/change/change.spec.js +1 -1
- package/src/directive/channel/channel.js +25 -7
- package/src/directive/channel/channel.spec.js +17 -0
- package/src/directive/class/class.js +1 -1
- package/src/directive/class/class.spec.js +2 -2
- package/src/directive/cloak/cloak.spec.js +1 -1
- package/src/directive/controller/controller.spec.js +2 -2
- package/src/directive/events/click.spec.js +1 -1
- package/src/directive/events/event.spec.js +1 -1
- package/src/directive/events/events.js +3 -3
- package/src/directive/form/form.js +2 -2
- package/src/directive/form/form.spec.js +1 -1
- package/src/directive/if/if.js +2 -3
- package/src/directive/if/if.md +0 -1
- package/src/directive/if/if.spec.js +2 -2
- package/src/directive/include/include.js +3 -3
- package/src/directive/include/include.spec.js +2 -2
- package/src/directive/init/init.spec.js +1 -1
- package/src/directive/input/input.js +1 -1
- package/src/directive/input/input.spec.js +1 -1
- package/src/directive/messages/messages.js +1 -1
- package/src/directive/messages/messages.spec.js +3 -3
- package/src/directive/model/model.js +7 -7
- package/src/directive/model/model.spec.js +2 -2
- package/src/directive/model-options/model-options.js +1 -1
- package/src/directive/model-options/model-options.spec.js +2 -2
- package/src/directive/non-bindable/non-bindable.spec.js +1 -1
- package/src/directive/observe/observe.spec.js +1 -1
- package/src/directive/options/options.js +6 -2
- package/src/directive/options/options.spec.js +2 -2
- package/src/directive/ref/href.spec.js +2 -2
- package/src/directive/ref/ref.js +1 -1
- package/src/directive/repeat/repeat.js +263 -255
- package/src/directive/repeat/repeat.md +0 -22
- package/src/directive/repeat/repeat.spec.js +2 -115
- package/src/directive/script/script.spec.js +1 -1
- package/src/directive/select/select.js +2 -2
- package/src/directive/select/select.spec.js +2 -2
- package/src/directive/show-hide/show-hide.js +1 -3
- package/src/directive/show-hide/show-hide.md +0 -2
- package/src/directive/show-hide/show-hide.spec.js +1 -1
- package/src/directive/style/style.spec.js +1 -1
- package/src/directive/switch/switch.js +2 -4
- package/src/directive/switch/switch.spec.js +1 -51
- package/src/directive/transclude/transclude.js +2 -2
- package/src/directive/validators/validators.js +2 -2
- package/src/directive/validators/validators.spec.js +1 -1
- package/src/filters/filter.js +1 -1
- package/src/filters/filter.spec.js +2 -2
- package/src/filters/filters.js +1 -1
- package/src/filters/filters.spec.js +1 -1
- package/src/filters/limit-to.js +1 -1
- package/src/filters/limit-to.spec.js +1 -1
- package/src/filters/order-by.js +1 -1
- package/src/index.js +3 -9
- package/src/loader.js +12 -16
- package/src/router/common/coreservices.js +1 -1
- package/src/router/common/trace.js +1 -1
- package/src/router/directives/state-directives.js +1 -1
- package/src/router/directives/state-directives.spec.js +1 -1
- package/src/router/directives/view-directive.js +2 -2
- package/src/router/directives/view-directive.spec.js +1 -1
- package/src/router/hooks/redirect-to.js +1 -1
- package/src/router/params/param-type.js +1 -1
- package/src/router/params/param-types.js +1 -1
- package/src/router/params/param.js +1 -1
- package/src/router/resolve/resolvable.js +1 -1
- package/src/router/resolve/resolve-context.js +1 -1
- package/src/router/state/state-builder.js +1 -1
- package/src/router/state/state-matcher.js +1 -1
- package/src/router/state/state-object.js +1 -1
- package/src/router/state/state-queue-manager.js +1 -1
- package/src/router/state/state-registry.js +2 -2
- package/src/router/state/state-service.js +1 -1
- package/src/router/state/state.spec.js +2 -2
- package/src/router/state/target-state.js +1 -1
- package/src/router/state/views.js +1 -1
- package/src/router/state-provider.js +1 -1
- package/src/router/template-factory.js +9 -8
- package/src/router/template-factory.spec.js +1 -1
- package/src/router/transition/hook-registry.js +1 -1
- package/src/router/transition/transition-service.js +1 -1
- package/src/router/transition/transition.js +1 -1
- package/src/router/url/url-config.js +1 -1
- package/src/router/url/url-matcher.js +2 -2
- package/src/router/url/url-rule.js +1 -1
- package/src/router/url/url-rules.js +1 -1
- package/src/router/url/url-service.js +6 -1
- package/src/router/url/url-service.spec.js +1 -1
- package/src/router/view/view.spec.js +1 -1
- package/src/router/view-hook.spec.js +1 -1
- package/src/router/view-scroll.spec.js +1 -1
- package/src/services/anchor-scroll.js +1 -1
- package/src/services/browser.js +2 -2
- package/src/services/cookie-reader.js +1 -1
- package/src/services/http/http.js +3 -3
- package/src/services/http/http.spec.js +1 -1
- package/src/services/http-backend/http-backend.js +1 -1
- package/src/services/log.js +1 -1
- package/src/services/template-request.js +2 -2
- package/src/shared/common.js +1 -1
- package/src/shared/jqlite/jqlite.js +9 -9
- package/src/shared/jqlite/jqlite.spec.js +11 -11
- package/src/shared/min-err.spec.js +6 -1
- package/src/shared/predicates.js +1 -1
- package/src/shared/strings.js +1 -1
- package/src/shared/test-utils.js +1 -1
- package/src/shared/utils.js +1 -1
- package/src/shared/utils.spec.js +1 -1
- package/src/types.js +0 -2
- package/types/animations/animate-css-driver.d.ts +1 -1
- package/types/animations/animate-js.d.ts +1 -1
- package/types/animations/animate.d.ts +1 -1
- package/types/animations/animation.d.ts +1 -1
- package/types/core/cache/cache.d.ts +1 -1
- package/types/core/compile/attributes.d.ts +2 -2
- package/types/core/compile/compile.d.ts +3 -2
- package/types/core/controller/controller.d.ts +1 -1
- package/types/core/filter/filter.d.ts +1 -1
- package/types/core/location/location.d.ts +1 -1
- package/types/core/q/q.d.ts +1 -1
- package/types/core/sce/sce.d.ts +1 -1
- package/types/core/scope/scope.d.ts +1 -1
- package/types/core/timeout/timeout.d.ts +1 -1
- package/types/directive/channel/channel.d.ts +13 -4
- package/types/directive/model/model.d.ts +9 -9
- package/types/directive/repeat/repeat.d.ts +10 -8
- package/types/loader.d.ts +5 -6
- package/types/router/common/coreservices.d.ts +1 -1
- package/types/router/state/state-registry.d.ts +2 -2
- package/types/router/template-factory.d.ts +2 -2
- package/types/services/browser.d.ts +1 -1
- package/types/services/http/http.d.ts +1 -1
- package/types/services/template-request.d.ts +1 -1
- package/types/shared/jqlite/jqlite.d.ts +1 -1
- package/types/shared/test-utils.d.ts +1 -1
- package/types/types.d.ts +1 -5
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
getOrSetCacheData,
|
|
6
6
|
isTextNode,
|
|
7
7
|
startingTag,
|
|
8
|
-
} from "../../shared/jqlite/jqlite";
|
|
9
|
-
import { identifierForController } from "../controller/controller";
|
|
10
|
-
import { TTL } from "../scope/scope";
|
|
8
|
+
} from "../../shared/jqlite/jqlite.js";
|
|
9
|
+
import { identifierForController } from "../controller/controller.js";
|
|
10
|
+
import { TTL } from "../scope/scope.js";
|
|
11
11
|
import {
|
|
12
12
|
minErr,
|
|
13
13
|
assertArg,
|
|
@@ -31,13 +31,13 @@ import {
|
|
|
31
31
|
simpleCompare,
|
|
32
32
|
isError,
|
|
33
33
|
directiveNormalize,
|
|
34
|
-
} from "../../shared/utils";
|
|
35
|
-
import { SCE_CONTEXTS } from "../sce/sce";
|
|
36
|
-
import { PREFIX_REGEXP } from "../../shared/constants";
|
|
37
|
-
import { createEventDirective } from "../../directive/events/events";
|
|
38
|
-
import {
|
|
39
|
-
import { Attributes } from "./attributes";
|
|
40
|
-
import { ngObserveDirective } from "../../directive/observe/observe";
|
|
34
|
+
} from "../../shared/utils.js";
|
|
35
|
+
import { SCE_CONTEXTS } from "../sce/sce.js";
|
|
36
|
+
import { PREFIX_REGEXP } from "../../shared/constants.js";
|
|
37
|
+
import { createEventDirective } from "../../directive/events/events.js";
|
|
38
|
+
import { Cache, EXPANDO } from "../cache/cache.js";
|
|
39
|
+
import { Attributes } from "./attributes.js";
|
|
40
|
+
import { ngObserveDirective } from "../../directive/observe/observe.js";
|
|
41
41
|
|
|
42
42
|
let ttl = TTL;
|
|
43
43
|
|
|
@@ -50,11 +50,10 @@ const $compileMinErr = minErr("$compile");
|
|
|
50
50
|
|
|
51
51
|
const UNINITALIZED_VALIED = new Object();
|
|
52
52
|
const EXCLUDED_DIRECTIVES = ["ngIf", "ngRepeat"];
|
|
53
|
-
|
|
53
|
+
export const DIRECTIVE_SUFFIX = "Directive";
|
|
54
54
|
CompileProvider.$inject = ["$provide", "$$sanitizeUriProvider"];
|
|
55
55
|
export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
56
56
|
const hasDirectives = {};
|
|
57
|
-
const Suffix = "Directive";
|
|
58
57
|
const ALL_OR_NOTHING_ATTRS = {
|
|
59
58
|
ngSrc: true,
|
|
60
59
|
ngSrcset: true,
|
|
@@ -196,14 +195,14 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
196
195
|
assertArg(directiveFactory, "directiveFactory");
|
|
197
196
|
if (!Object.prototype.hasOwnProperty.call(hasDirectives, name)) {
|
|
198
197
|
hasDirectives[name] = [];
|
|
199
|
-
$provide.factory(name +
|
|
198
|
+
$provide.factory(name + DIRECTIVE_SUFFIX, [
|
|
200
199
|
"$injector",
|
|
201
200
|
"$exceptionHandler",
|
|
202
201
|
/**
|
|
203
202
|
*
|
|
204
|
-
* @param {import("../../core/di/internal-injector").InjectorService} $injector
|
|
205
|
-
* @param {import(
|
|
206
|
-
* @returns
|
|
203
|
+
* @param {import("../../core/di/internal-injector.js").InjectorService} $injector
|
|
204
|
+
* @param {import("../exception-handler.js").ErrorHandler} $exceptionHandler
|
|
205
|
+
* @returns {import("../../types.js").Directive[]}
|
|
207
206
|
*/
|
|
208
207
|
function ($injector, $exceptionHandler) {
|
|
209
208
|
const directives = [];
|
|
@@ -524,7 +523,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
524
523
|
"$sce",
|
|
525
524
|
"$animate",
|
|
526
525
|
/**
|
|
527
|
-
* @param {import("../../core/di/internal-injector").InjectorService} $injector
|
|
526
|
+
* @param {import("../../core/di/internal-injector.js").InjectorService} $injector
|
|
528
527
|
* @param {*} $interpolate
|
|
529
528
|
* @param {import("../exception-handler").ErrorHandler} $exceptionHandler
|
|
530
529
|
* @param {*} $templateRequest
|
|
@@ -588,7 +587,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
588
587
|
: (x) => x.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
|
|
589
588
|
|
|
590
589
|
const NG_PREFIX_BINDING = /^ng(Attr|Prop|On|Observe)([A-Z].*)$/;
|
|
591
|
-
const MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;
|
|
592
590
|
return compile;
|
|
593
591
|
|
|
594
592
|
//= ===============================
|
|
@@ -724,7 +722,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
724
722
|
* Compile function matches each node in nodeList against the directives. Once all directives
|
|
725
723
|
* for a particular node are collected their compile functions are executed. The compile
|
|
726
724
|
* functions return values - the linking functions - are combined into a composite linking
|
|
727
|
-
* function, which is the
|
|
725
|
+
* function, which is the linking function for the node.
|
|
728
726
|
*
|
|
729
727
|
* @param {NodeList|JQLite} nodeList an array of nodes or NodeList to compile
|
|
730
728
|
* @param {*} transcludeFn A linking function, where the
|
|
@@ -746,27 +744,29 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
746
744
|
previousCompileContext,
|
|
747
745
|
) {
|
|
748
746
|
const linkFns = [];
|
|
749
|
-
let attrs;
|
|
750
|
-
let directives;
|
|
751
747
|
/**
|
|
752
748
|
* @type {any}
|
|
753
749
|
*/
|
|
754
|
-
var nodeLinkFn;
|
|
750
|
+
var nodeLinkFn = null;
|
|
755
751
|
let childNodes;
|
|
756
752
|
let childLinkFn;
|
|
757
753
|
let linkFnFound;
|
|
758
754
|
let nodeLinkFnFound;
|
|
759
755
|
|
|
760
756
|
for (let i = 0; i < nodeList.length; i++) {
|
|
761
|
-
attrs = new Attributes(
|
|
757
|
+
const attrs = new Attributes(
|
|
758
|
+
$rootScope,
|
|
759
|
+
$animate,
|
|
760
|
+
$exceptionHandler,
|
|
761
|
+
$sce,
|
|
762
|
+
);
|
|
762
763
|
|
|
763
764
|
// We must always refer to `nodeList[i]` hereafter,
|
|
764
765
|
// since the nodes can be replaced underneath us.
|
|
765
|
-
directives = collectDirectives(
|
|
766
|
+
const directives = collectDirectives(
|
|
766
767
|
/** @type Element */ (nodeList[i]),
|
|
767
|
-
[],
|
|
768
768
|
attrs,
|
|
769
|
-
|
|
769
|
+
maxPriority,
|
|
770
770
|
ignoreDirective,
|
|
771
771
|
);
|
|
772
772
|
|
|
@@ -823,8 +823,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
823
823
|
let childLinkFn;
|
|
824
824
|
let node;
|
|
825
825
|
let childScope;
|
|
826
|
-
let i;
|
|
827
|
-
let ii;
|
|
828
826
|
let idx;
|
|
829
827
|
let childBoundTranscludeFn;
|
|
830
828
|
let stableNodeList;
|
|
@@ -835,7 +833,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
835
833
|
stableNodeList = new Array(nodeList.length);
|
|
836
834
|
|
|
837
835
|
// create a sparse array by only copying the elements which have a linkFn
|
|
838
|
-
for (i = 0; i < linkFns.length; i += 3) {
|
|
836
|
+
for (let i = 0; i < linkFns.length; i += 3) {
|
|
839
837
|
idx = linkFns[i];
|
|
840
838
|
stableNodeList[idx] = nodeList[idx];
|
|
841
839
|
}
|
|
@@ -843,7 +841,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
843
841
|
stableNodeList = nodeList;
|
|
844
842
|
}
|
|
845
843
|
|
|
846
|
-
for (i = 0, ii = linkFns.length; i < ii; ) {
|
|
844
|
+
for (let i = 0, ii = linkFns.length; i < ii; ) {
|
|
847
845
|
node = stableNodeList[linkFns[i++]];
|
|
848
846
|
nodeLinkFn = linkFns[i++];
|
|
849
847
|
childLinkFn = linkFns[i++];
|
|
@@ -945,15 +943,14 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
945
943
|
* the function returns.
|
|
946
944
|
* @param {Attributes|import("./attributes").AttributeLike} attrs The shared attrs object which is used to populate the normalized attributes.
|
|
947
945
|
* @param {number=} maxPriority Max directive priority.
|
|
948
|
-
* @param {
|
|
946
|
+
* @param {string} [ignoreDirective]
|
|
947
|
+
* @return {import('../../types.js').Directive[]} An array to which the directives are added to. This array is sorted before the function returns.
|
|
949
948
|
*/
|
|
950
|
-
function collectDirectives(
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
ignoreDirective,
|
|
956
|
-
) {
|
|
949
|
+
function collectDirectives(node, attrs, maxPriority, ignoreDirective) {
|
|
950
|
+
/**
|
|
951
|
+
* @type {import('../../types.js').Directive[]}
|
|
952
|
+
*/
|
|
953
|
+
const directives = [];
|
|
957
954
|
const { nodeType } = node;
|
|
958
955
|
const attrsMap = attrs.$attr;
|
|
959
956
|
let nodeName;
|
|
@@ -961,49 +958,31 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
961
958
|
switch (nodeType) {
|
|
962
959
|
case Node.ELEMENT_NODE /* Element */:
|
|
963
960
|
nodeName = node.nodeName.toLowerCase();
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
961
|
+
if (ignoreDirective !== directiveNormalize(nodeName)) {
|
|
962
|
+
// use the node name: <directive>
|
|
963
|
+
addDirective(
|
|
964
|
+
directives,
|
|
965
|
+
directiveNormalize(nodeName),
|
|
966
|
+
"E",
|
|
967
|
+
maxPriority,
|
|
968
|
+
);
|
|
969
|
+
}
|
|
973
970
|
|
|
974
971
|
// iterate over the attributes
|
|
975
|
-
for (
|
|
976
|
-
var attr,
|
|
977
|
-
name,
|
|
978
|
-
nName,
|
|
979
|
-
value,
|
|
980
|
-
ngPrefixMatch,
|
|
981
|
-
nAttrs = node.attributes,
|
|
982
|
-
j = 0,
|
|
983
|
-
jj = nAttrs && nAttrs.length;
|
|
984
|
-
j < jj;
|
|
985
|
-
j++
|
|
986
|
-
) {
|
|
987
|
-
/** @type {string|boolean} */
|
|
988
|
-
let attrStartName = false;
|
|
989
|
-
|
|
990
|
-
/** @type {string|boolean} */
|
|
991
|
-
let attrEndName = false;
|
|
992
|
-
|
|
972
|
+
for (let j = 0; j < node.attributes?.length; j++) {
|
|
993
973
|
let isNgAttr = false;
|
|
994
974
|
let isNgProp = false;
|
|
995
975
|
let isNgEvent = false;
|
|
996
976
|
let isNgObserve = false;
|
|
997
|
-
let multiElementMatch;
|
|
998
977
|
|
|
999
|
-
attr =
|
|
1000
|
-
name = attr.name;
|
|
1001
|
-
value = attr.value;
|
|
1002
|
-
|
|
1003
|
-
nName = directiveNormalize(name.toLowerCase());
|
|
978
|
+
let attr = node.attributes[j];
|
|
979
|
+
let name = attr.name;
|
|
980
|
+
let value = attr.value;
|
|
981
|
+
let nName = directiveNormalize(name.toLowerCase());
|
|
1004
982
|
|
|
1005
983
|
// Support ng-attr-*, ng-prop-* and ng-on-*
|
|
1006
|
-
|
|
984
|
+
const ngPrefixMatch = nName.match(NG_PREFIX_BINDING);
|
|
985
|
+
if (ngPrefixMatch) {
|
|
1007
986
|
isNgAttr = ngPrefixMatch[1] === "Attr";
|
|
1008
987
|
isNgProp = ngPrefixMatch[1] === "Prop";
|
|
1009
988
|
isNgEvent = ngPrefixMatch[1] === "On";
|
|
@@ -1015,15 +994,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1015
994
|
.toLowerCase()
|
|
1016
995
|
.substring(4 + ngPrefixMatch[1].length)
|
|
1017
996
|
.replace(/_(.)/g, (match, letter) => letter.toUpperCase());
|
|
1018
|
-
|
|
1019
|
-
// Support *-start / *-end multi element directives
|
|
1020
|
-
} else if (
|
|
1021
|
-
(multiElementMatch = nName.match(MULTI_ELEMENT_DIR_RE)) &&
|
|
1022
|
-
directiveIsMultiElement(multiElementMatch[1])
|
|
1023
|
-
) {
|
|
1024
|
-
attrStartName = name;
|
|
1025
|
-
attrEndName = `${name.substring(0, name.length - 5)}end`;
|
|
1026
|
-
name = name.substring(0, name.length - 6);
|
|
1027
997
|
}
|
|
1028
998
|
|
|
1029
999
|
if (isNgProp || isNgEvent) {
|
|
@@ -1033,10 +1003,19 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1033
1003
|
if (isNgProp) {
|
|
1034
1004
|
addPropertyDirective(node, directives, nName, name);
|
|
1035
1005
|
} else {
|
|
1036
|
-
|
|
1006
|
+
directives.push(
|
|
1007
|
+
createEventDirective(
|
|
1008
|
+
$parse,
|
|
1009
|
+
$rootScope,
|
|
1010
|
+
$exceptionHandler,
|
|
1011
|
+
nName,
|
|
1012
|
+
name,
|
|
1013
|
+
/* forceAsync= */ false,
|
|
1014
|
+
),
|
|
1015
|
+
);
|
|
1037
1016
|
}
|
|
1038
1017
|
} else if (isNgObserve) {
|
|
1039
|
-
|
|
1018
|
+
directives.push(ngObserveDirective(name, value));
|
|
1040
1019
|
} else {
|
|
1041
1020
|
// Update nName for cases where a prefix was removed
|
|
1042
1021
|
// NOTE: the .toLowerCase() is unnecessary and causes https://github.com/angular/angular.js/issues/16624 for ng-attr-*
|
|
@@ -1060,15 +1039,10 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1060
1039
|
nName,
|
|
1061
1040
|
isNgAttr,
|
|
1062
1041
|
);
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
nName,
|
|
1066
|
-
|
|
1067
|
-
maxPriority,
|
|
1068
|
-
ignoreDirective,
|
|
1069
|
-
attrStartName,
|
|
1070
|
-
attrEndName,
|
|
1071
|
-
);
|
|
1042
|
+
|
|
1043
|
+
if (nName !== ignoreDirective) {
|
|
1044
|
+
addDirective(directives, nName, "A", maxPriority);
|
|
1045
|
+
}
|
|
1072
1046
|
}
|
|
1073
1047
|
}
|
|
1074
1048
|
|
|
@@ -1093,62 +1067,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1093
1067
|
return directives;
|
|
1094
1068
|
}
|
|
1095
1069
|
|
|
1096
|
-
/**
|
|
1097
|
-
* Given a node with a directive-start it collects all of the siblings until it finds
|
|
1098
|
-
* directive-end.
|
|
1099
|
-
* @param {Element} node
|
|
1100
|
-
* @param {string} attrStart
|
|
1101
|
-
* @param {string} attrEnd
|
|
1102
|
-
* @returns {*}
|
|
1103
|
-
*/
|
|
1104
|
-
function groupScan(node, attrStart, attrEnd) {
|
|
1105
|
-
const nodes = [];
|
|
1106
|
-
let depth = 0;
|
|
1107
|
-
if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {
|
|
1108
|
-
do {
|
|
1109
|
-
if (!node) {
|
|
1110
|
-
throw $compileMinErr(
|
|
1111
|
-
"uterdir",
|
|
1112
|
-
"Unterminated attribute, found '{0}' but no matching '{1}' found.",
|
|
1113
|
-
attrStart,
|
|
1114
|
-
attrEnd,
|
|
1115
|
-
);
|
|
1116
|
-
}
|
|
1117
|
-
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
1118
|
-
if (node.hasAttribute(attrStart)) depth++;
|
|
1119
|
-
if (node.hasAttribute(attrEnd)) depth--;
|
|
1120
|
-
}
|
|
1121
|
-
nodes.push(node);
|
|
1122
|
-
node = /** @type {Element} */ (node.nextSibling);
|
|
1123
|
-
} while (depth > 0);
|
|
1124
|
-
} else {
|
|
1125
|
-
nodes.push(node);
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
return JQLite(nodes);
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
/**
|
|
1132
|
-
* Wrapper for linking function which converts normal linking function into a grouped
|
|
1133
|
-
* linking function.
|
|
1134
|
-
* @param linkFn
|
|
1135
|
-
* @param attrStart
|
|
1136
|
-
* @param attrEnd
|
|
1137
|
-
* @returns {Function}
|
|
1138
|
-
*/
|
|
1139
|
-
function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
|
|
1140
|
-
return function groupedElementsLink(
|
|
1141
|
-
scope,
|
|
1142
|
-
element,
|
|
1143
|
-
attrs,
|
|
1144
|
-
controllers,
|
|
1145
|
-
transcludeFn,
|
|
1146
|
-
) {
|
|
1147
|
-
element = groupScan(element[0], attrStart, attrEnd);
|
|
1148
|
-
return linkFn(scope, element, attrs, controllers, transcludeFn);
|
|
1149
|
-
};
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
1070
|
/**
|
|
1153
1071
|
* A function generator that is used to support both eager and lazy compilation
|
|
1154
1072
|
* linking function.
|
|
@@ -1540,17 +1458,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1540
1458
|
// executes all directives on the current element
|
|
1541
1459
|
for (let i = 0, ii = directives.length; i < ii; i++) {
|
|
1542
1460
|
directive = directives[i];
|
|
1543
|
-
const attrStart = directive.$$start;
|
|
1544
|
-
const attrEnd = directive.$$end;
|
|
1545
|
-
|
|
1546
|
-
// collect multiblock sections
|
|
1547
|
-
if (attrStart) {
|
|
1548
|
-
$compileNode = groupScan(
|
|
1549
|
-
/** @type {Element} */ (compileNode),
|
|
1550
|
-
attrStart,
|
|
1551
|
-
attrEnd,
|
|
1552
|
-
);
|
|
1553
|
-
}
|
|
1554
1461
|
$template = undefined;
|
|
1555
1462
|
|
|
1556
1463
|
if (terminalPriority > directive.priority) {
|
|
@@ -1828,7 +1735,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1828
1735
|
// - combine directives as: processed + template + unprocessed
|
|
1829
1736
|
const templateDirectives = collectDirectives(
|
|
1830
1737
|
/** @type {Element} */ (compileNode),
|
|
1831
|
-
[],
|
|
1832
1738
|
newTemplateAttrs,
|
|
1833
1739
|
);
|
|
1834
1740
|
const unprocessedDirectives = directives.splice(
|
|
@@ -1898,13 +1804,11 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1898
1804
|
);
|
|
1899
1805
|
const context = directive.$$originalDirective || directive;
|
|
1900
1806
|
if (isFunction(linkFn)) {
|
|
1901
|
-
addLinkFns(null, bind(context, linkFn)
|
|
1807
|
+
addLinkFns(null, bind(context, linkFn));
|
|
1902
1808
|
} else if (linkFn) {
|
|
1903
1809
|
addLinkFns(
|
|
1904
1810
|
bind(context, linkFn.pre),
|
|
1905
1811
|
bind(context, linkFn.post),
|
|
1906
|
-
attrStart,
|
|
1907
|
-
attrEnd,
|
|
1908
1812
|
);
|
|
1909
1813
|
}
|
|
1910
1814
|
} catch (e) {
|
|
@@ -1932,10 +1836,8 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1932
1836
|
|
|
1933
1837
|
/// /////////////////
|
|
1934
1838
|
|
|
1935
|
-
function addLinkFns(pre, post
|
|
1839
|
+
function addLinkFns(pre, post) {
|
|
1936
1840
|
if (pre) {
|
|
1937
|
-
if (attrStart)
|
|
1938
|
-
pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);
|
|
1939
1841
|
pre.require = directive.require;
|
|
1940
1842
|
pre.directiveName = directiveName;
|
|
1941
1843
|
if (
|
|
@@ -1947,8 +1849,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
1947
1849
|
preLinkFns.push(pre);
|
|
1948
1850
|
}
|
|
1949
1851
|
if (post) {
|
|
1950
|
-
if (attrStart)
|
|
1951
|
-
post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);
|
|
1952
1852
|
post.require = directive.require;
|
|
1953
1853
|
post.directiveName = directiveName;
|
|
1954
1854
|
if (
|
|
@@ -2103,45 +2003,25 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2103
2003
|
* looks up the directive and decorates it with exception handling and proper parameters. We
|
|
2104
2004
|
* call this the boundDirective.
|
|
2105
2005
|
*
|
|
2006
|
+
* @param {import('../../types.js').Directive[]} tDirectives
|
|
2106
2007
|
* @param {string} name name of the directive to look up.
|
|
2107
2008
|
* @param {string} location The directive must be found in specific format.
|
|
2108
2009
|
* String containing any of these characters:
|
|
2109
|
-
*
|
|
2110
2010
|
* * `E`: element name
|
|
2111
2011
|
* * `A': attribute
|
|
2012
|
+
* @param maxPriority
|
|
2112
2013
|
* @returns {boolean} true if directive was added.
|
|
2113
2014
|
*/
|
|
2114
|
-
function addDirective(
|
|
2115
|
-
tDirectives,
|
|
2116
|
-
name,
|
|
2117
|
-
location,
|
|
2118
|
-
maxPriority,
|
|
2119
|
-
ignoreDirective,
|
|
2120
|
-
startAttrName,
|
|
2121
|
-
endAttrName,
|
|
2122
|
-
) {
|
|
2123
|
-
if (name === ignoreDirective) return false;
|
|
2015
|
+
function addDirective(tDirectives, name, location, maxPriority) {
|
|
2124
2016
|
let match = false;
|
|
2125
2017
|
if (Object.prototype.hasOwnProperty.call(hasDirectives, name)) {
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
i = 0,
|
|
2130
|
-
ii = directives.length;
|
|
2131
|
-
i < ii;
|
|
2132
|
-
i++
|
|
2133
|
-
) {
|
|
2134
|
-
directive = directives[i];
|
|
2018
|
+
let directives = $injector.get(name + DIRECTIVE_SUFFIX);
|
|
2019
|
+
for (let i = 0, ii = directives.length; i < ii; i++) {
|
|
2020
|
+
let directive = directives[i];
|
|
2135
2021
|
if (
|
|
2136
2022
|
(isUndefined(maxPriority) || maxPriority > directive.priority) &&
|
|
2137
2023
|
directive.restrict.indexOf(location) !== -1
|
|
2138
2024
|
) {
|
|
2139
|
-
if (startAttrName) {
|
|
2140
|
-
directive = inherit(directive, {
|
|
2141
|
-
$$start: startAttrName,
|
|
2142
|
-
$$end: endAttrName,
|
|
2143
|
-
});
|
|
2144
|
-
}
|
|
2145
2025
|
if (!directive.$$bindings) {
|
|
2146
2026
|
const bindings = (directive.$$bindings = parseDirectiveBindings(
|
|
2147
2027
|
directive,
|
|
@@ -2159,33 +2039,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2159
2039
|
return match;
|
|
2160
2040
|
}
|
|
2161
2041
|
|
|
2162
|
-
/**
|
|
2163
|
-
* looks up the directive and returns true if it is a multi-element directive,
|
|
2164
|
-
* and therefore requires DOM nodes between -start and -end markers to be grouped
|
|
2165
|
-
* together. Example: `<div my-directive-start></div><div><div/><div my-directive-end></div>`
|
|
2166
|
-
*
|
|
2167
|
-
* @param {string} name name of the directive to look up.
|
|
2168
|
-
* @returns true if directive was registered as multi-element.
|
|
2169
|
-
*/
|
|
2170
|
-
function directiveIsMultiElement(name) {
|
|
2171
|
-
if (Object.prototype.hasOwnProperty.call(hasDirectives, name)) {
|
|
2172
|
-
for (
|
|
2173
|
-
let directive,
|
|
2174
|
-
directives = $injector.get(name + Suffix),
|
|
2175
|
-
i = 0,
|
|
2176
|
-
ii = directives.length;
|
|
2177
|
-
i < ii;
|
|
2178
|
-
i++
|
|
2179
|
-
) {
|
|
2180
|
-
directive = directives[i];
|
|
2181
|
-
if (directive.multiElement) {
|
|
2182
|
-
return true;
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
}
|
|
2186
|
-
return false;
|
|
2187
|
-
}
|
|
2188
|
-
|
|
2189
2042
|
/**
|
|
2190
2043
|
* When the element is replaced with HTML template then the new attributes
|
|
2191
2044
|
* on the template need to be merged with the existing attributes in the DOM.
|
|
@@ -2295,7 +2148,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2295
2148
|
replaceWith($rootElement, $compileNode, compileNode);
|
|
2296
2149
|
const templateDirectives = collectDirectives(
|
|
2297
2150
|
compileNode,
|
|
2298
|
-
[],
|
|
2299
2151
|
tempTemplateAttrs,
|
|
2300
2152
|
);
|
|
2301
2153
|
|
|
@@ -2458,15 +2310,13 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2458
2310
|
}
|
|
2459
2311
|
|
|
2460
2312
|
function addTextInterpolateDirective(directives, text) {
|
|
2461
|
-
const interpolateFn = $interpolate(text, true);
|
|
2313
|
+
const interpolateFn = $interpolate(text, true);
|
|
2462
2314
|
if (interpolateFn) {
|
|
2463
2315
|
directives.push({
|
|
2464
2316
|
priority: 0,
|
|
2465
|
-
// When transcluding a template that has bindings in the root
|
|
2466
|
-
// we don't have a parent and thus need to add the class during linking fn.
|
|
2467
2317
|
compile: () => (scope, node) => {
|
|
2468
2318
|
scope.$watch(interpolateFn, (value) => {
|
|
2469
|
-
node[0].nodeValue = value;
|
|
2319
|
+
node[0].nodeValue = value;
|
|
2470
2320
|
});
|
|
2471
2321
|
},
|
|
2472
2322
|
});
|
|
@@ -2538,10 +2388,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2538
2388
|
);
|
|
2539
2389
|
}
|
|
2540
2390
|
|
|
2541
|
-
function sanitizeSrcsetPropertyValue(value) {
|
|
2542
|
-
return sanitizeSrcset($sce.valueOf(value), "ng-prop-srcset");
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
2391
|
function sanitizeSrcset(value, invokeType) {
|
|
2546
2392
|
if (!value) {
|
|
2547
2393
|
return value;
|
|
@@ -2614,7 +2460,8 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2614
2460
|
propName === "srcset" &&
|
|
2615
2461
|
(nodeName === "img" || nodeName === "source")
|
|
2616
2462
|
) {
|
|
2617
|
-
sanitizer =
|
|
2463
|
+
sanitizer = (value) =>
|
|
2464
|
+
sanitizeSrcset($sce.valueOf(value), "ng-prop-srcset");
|
|
2618
2465
|
} else if (trustedContext) {
|
|
2619
2466
|
sanitizer = $sce.getTrusted.bind($sce, trustedContext);
|
|
2620
2467
|
}
|
|
@@ -2643,23 +2490,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2643
2490
|
});
|
|
2644
2491
|
}
|
|
2645
2492
|
|
|
2646
|
-
function addEventDirective(directives, attrName, eventName) {
|
|
2647
|
-
directives.push(
|
|
2648
|
-
createEventDirective(
|
|
2649
|
-
$parse,
|
|
2650
|
-
$rootScope,
|
|
2651
|
-
$exceptionHandler,
|
|
2652
|
-
attrName,
|
|
2653
|
-
eventName,
|
|
2654
|
-
/* forceAsync= */ false,
|
|
2655
|
-
),
|
|
2656
|
-
);
|
|
2657
|
-
}
|
|
2658
|
-
|
|
2659
|
-
function addObserveDirective(directives, source, prop) {
|
|
2660
|
-
directives.push(ngObserveDirective(source, prop));
|
|
2661
|
-
}
|
|
2662
|
-
|
|
2663
2493
|
function addAttrInterpolateDirective(
|
|
2664
2494
|
node,
|
|
2665
2495
|
directives,
|
|
@@ -2800,7 +2630,7 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2800
2630
|
fragment.appendChild(elementsToRemove[i]);
|
|
2801
2631
|
}
|
|
2802
2632
|
|
|
2803
|
-
if (
|
|
2633
|
+
if (Cache.has(firstElementToRemove[EXPANDO])) {
|
|
2804
2634
|
// Copy over user data (that includes AngularJS's $scope etc.). Don't copy private
|
|
2805
2635
|
// data here because there's no public interface in jQuery to do that and copying over
|
|
2806
2636
|
// event listeners (which is the main use of private data) wouldn't work anyway.
|
|
@@ -70,7 +70,6 @@
|
|
|
70
70
|
- {@link $compile#-controlleras- controllerAs}: 'stringIdentifier',
|
|
71
71
|
- {@link $compile#-bindtocontroller- bindToController}: false,
|
|
72
72
|
- {@link $compile#-require- require}: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
|
|
73
|
-
- {@link $compile#-multielement- multiElement}: false,
|
|
74
73
|
- {@link $compile#-compile- compile}: function compile(tElement, tAttrs, transclude) {
|
|
75
74
|
- return {
|
|
76
75
|
- {@link $compile#pre-linking-function pre}: function preLink(scope, iElement, iAttrs, controller) { ... },
|
|
@@ -234,13 +233,6 @@
|
|
|
234
233
|
- The directive definition object provides instructions to the {@link ng.$compile
|
|
235
234
|
- compiler}. The attributes are:
|
|
236
235
|
-
|
|
237
|
-
- #### `multiElement`
|
|
238
|
-
- When this property is set to true (default is `false`), the HTML compiler will collect DOM nodes between
|
|
239
|
-
- nodes with the attributes `directive-name-start` and `directive-name-end`, and group them
|
|
240
|
-
- together as the directive elements. It is recommended that this feature be used on directives
|
|
241
|
-
- which are not strictly behavioral (such as {@link ngClick}), and which
|
|
242
|
-
- do not manipulate or replace child nodes (such as {@link ngInclude}).
|
|
243
|
-
-
|
|
244
236
|
- #### `priority`
|
|
245
237
|
- When there are multiple directives defined on a single DOM element, sometimes it
|
|
246
238
|
- is necessary to specify the order in which the directives are applied. The `priority` is used
|