Skip to content

Commit 75aeff4

Browse files
committed
Deprecate multiElement directives
1 parent 632938d commit 75aeff4

File tree

152 files changed

+227
-1059
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+227
-1059
lines changed

src/angular.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import {
2222
nextUid,
2323
getNodeName,
2424
snakeCase,
25-
} from "./shared/utils";
26-
import { dealoc, JQLite, startingTag } from "./shared/jqlite/jqlite";
25+
} from "./shared/utils.js";
26+
import { dealoc, JQLite, startingTag } from "./shared/jqlite/jqlite.js";
2727
import { Angular } from "./loader";
2828
import { createInjector } from "./core/di/injector";
2929

src/animations/animate-children-directive.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isString } from "../shared/utils";
1+
import { isString } from "../shared/utils.js";
22
import { NG_ANIMATE_CHILDREN_DATA } from "./shared";
33

44
$$AnimateChildrenDirective.$inject = ["$interpolate"];

src/animations/animate-css-driver.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { JQLite } from "../shared/jqlite/jqlite";
2-
import { isString } from "../shared/utils";
1+
import { JQLite } from "../shared/jqlite/jqlite.js";
2+
import { isString } from "../shared/utils.js";
33
import { concatWithSpace, getDomNode } from "./shared";
44

55
const NG_ANIMATE_SHIM_CLASS_NAME = "ng-animate-shim";

src/animations/animate-css.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isDefined } from "../shared/utils";
1+
import { isDefined } from "../shared/utils.js";
22
import {
33
TRANSITION_DURATION_PROP,
44
TRANSITION_DELAY_PROP,

src/animations/animate-js.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isObject, isFunction } from "../shared/utils";
1+
import { isObject, isFunction } from "../shared/utils.js";
22
import {
33
applyAnimationClassesFactory,
44
applyAnimationStyles,

src/animations/animate-queue.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { getOrSetCacheData, JQLite } from "../shared/jqlite/jqlite";
1+
import { getOrSetCacheData, JQLite } from "../shared/jqlite/jqlite.js";
22
import {
33
isUndefined,
44
isObject,
55
isString,
66
isElement,
77
isDefined,
88
extend,
9-
} from "../shared/utils";
9+
} from "../shared/utils.js";
1010
import {
1111
NG_ANIMATE_CHILDREN_DATA,
1212
applyAnimationClassesFactory,

src/animations/animate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { isFunction, isObject, minErr, extend } from "../shared/utils";
2-
import { JQLite } from "../shared/jqlite/jqlite";
1+
import { isFunction, isObject, minErr, extend } from "../shared/utils.js";
2+
import { JQLite } from "../shared/jqlite/jqlite.js";
33
import { NG_ANIMATE_CLASSNAME } from "./shared";
44

55
/** @typedef {"enter"|"leave"|"move"|"addClass"|"setClass"|"removeClass"} AnimationMethod */

src/animations/animate.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
1+
import { dealoc, JQLite } from "../../shared/jqlite/jqlite.js";
22
import { Angular } from "../../loader";
3-
import { isObject } from "../../shared/utils";
4-
import { isFunction } from "../../shared/utils";
3+
import { isObject } from "../../shared/utils.js";
4+
import { isFunction } from "../../shared/utils.js";
55
import { createInjector } from "../di/injector";
66

77
describe("$animate", () => {

src/animations/animation.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { JQLite } from "../shared/jqlite/jqlite";
2-
import { mergeClasses } from "../shared/utils";
1+
import { JQLite } from "../shared/jqlite/jqlite.js";
2+
import { mergeClasses } from "../shared/utils.js";
33
import {
44
NG_ANIMATE_CLASSNAME,
55
PREPARE_CLASS_SUFFIX,

src/binding.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { JQLite, dealoc } from "./shared/jqlite/jqlite";
1+
import { JQLite, dealoc } from "./shared/jqlite/jqlite.js";
22
import { Angular } from "./loader";
33
import { browserTrigger } from "./shared/test-utils";
44

src/core/compile/attributes.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getBooleanAttrName } from "../../shared/jqlite/jqlite";
1+
import { getBooleanAttrName } from "../../shared/jqlite/jqlite.js";
22
import {
33
isString,
44
snakeCase,
@@ -7,8 +7,8 @@ import {
77
minErr,
88
trim,
99
directiveNormalize,
10-
} from "../../shared/utils";
11-
import { ALIASED_ATTR } from "../../shared/constants";
10+
} from "../../shared/utils.js";
11+
import { ALIASED_ATTR } from "../../shared/constants.js";
1212

1313
const $compileMinErr = minErr("$compile");
1414
const SIMPLE_ATTR_NAME = /^\w/;

src/core/compile/compile.js

+10-48
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {
55
getOrSetCacheData,
66
isTextNode,
77
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";
1111
import {
1212
minErr,
1313
assertArg,
@@ -31,13 +31,13 @@ import {
3131
simpleCompare,
3232
isError,
3333
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 { CACHE, EXPANDO } from "../cache/cache";
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";
4141

4242
let ttl = TTL;
4343

@@ -588,7 +588,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
588588
: (x) => x.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
589589

590590
const NG_PREFIX_BINDING = /^ng(Attr|Prop|On|Observe)([A-Z].*)$/;
591-
const MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;
592591
return compile;
593592

594593
//= ===============================
@@ -994,7 +993,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
994993
let isNgProp = false;
995994
let isNgEvent = false;
996995
let isNgObserve = false;
997-
let multiElementMatch;
998996

999997
attr = nAttrs[j];
1000998
name = attr.name;
@@ -1015,15 +1013,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
10151013
.toLowerCase()
10161014
.substring(4 + ngPrefixMatch[1].length)
10171015
.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);
10271016
}
10281017

10291018
if (isNgProp || isNgEvent) {
@@ -2159,33 +2148,6 @@ export function CompileProvider($provide, $$sanitizeUriProvider) {
21592148
return match;
21602149
}
21612150

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-
21892151
/**
21902152
* When the element is replaced with HTML template then the new attributes
21912153
* on the template need to be merged with the existing attributes in the DOM.

src/core/compile/compile.md

-8
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
- {@link $compile#-controlleras- controllerAs}: 'stringIdentifier',
7171
- {@link $compile#-bindtocontroller- bindToController}: false,
7272
- {@link $compile#-require- require}: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
73-
- {@link $compile#-multielement- multiElement}: false,
7473
- {@link $compile#-compile- compile}: function compile(tElement, tAttrs, transclude) {
7574
- return {
7675
- {@link $compile#pre-linking-function pre}: function preLink(scope, iElement, iAttrs, controller) { ... },
@@ -234,13 +233,6 @@
234233
- The directive definition object provides instructions to the {@link ng.$compile
235234
- compiler}. The attributes are:
236235
-
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-
-
244236
- #### `priority`
245237
- When there are multiple directives defined on a single DOM element, sometimes it
246238
- is necessary to specify the order in which the directives are applied. The `priority` is used

0 commit comments

Comments
 (0)