MCPcopy Create free account
hub / github.com/angular-ui/ui-router / mergeAnimationDetails

Function mergeAnimationDetails

test/angular/1.4/angular-animate.js:226–265  ·  view source on GitHub ↗
(element, oldAnimation, newAnimation)

Source from the content-addressed store, hash-verified

224}
225
226function mergeAnimationDetails(element, oldAnimation, newAnimation) {
227 var target = oldAnimation.options || {};
228 var newOptions = newAnimation.options || {};
229
230 var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || '');
231 var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || '');
232 var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove);
233
234 if (newOptions.preparationClasses) {
235 target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses);
236 delete newOptions.preparationClasses;
237 }
238
239 // noop is basically when there is no callback; otherwise something has been set
240 var realDomOperation = target.domOperation !== noop ? target.domOperation : null;
241
242 extend(target, newOptions);
243
244 // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this.
245 if (realDomOperation) {
246 target.domOperation = realDomOperation;
247 }
248
249 if (classes.addClass) {
250 target.addClass = classes.addClass;
251 } else {
252 target.addClass = null;
253 }
254
255 if (classes.removeClass) {
256 target.removeClass = classes.removeClass;
257 } else {
258 target.removeClass = null;
259 }
260
261 oldAnimation.addClass = target.addClass;
262 oldAnimation.removeClass = target.removeClass;
263
264 return target;
265}
266
267function resolveElementClasses(existing, toAdd, toRemove) {
268 var ADD_CLASS = 1;

Callers 2

queueAnimationFunction · 0.70

Calls 3

resolveElementClassesFunction · 0.70
concatWithSpaceFunction · 0.70
extendFunction · 0.70

Tested by

no test coverage detected