(element, parentElement)
| 1072 | } |
| 1073 | |
| 1074 | function animationsDisabled(element, parentElement) { |
| 1075 | if (rootAnimateState.disabled) { |
| 1076 | return true; |
| 1077 | } |
| 1078 | |
| 1079 | if (isMatchingElement(element, $rootElement)) { |
| 1080 | return rootAnimateState.running; |
| 1081 | } |
| 1082 | |
| 1083 | var allowChildAnimations, parentRunningAnimation, hasParent; |
| 1084 | do { |
| 1085 | //the element did not reach the root element which means that it |
| 1086 | //is not apart of the DOM. Therefore there is no reason to do |
| 1087 | //any animations on it |
| 1088 | if (parentElement.length === 0) break; |
| 1089 | |
| 1090 | var isRoot = isMatchingElement(parentElement, $rootElement); |
| 1091 | var state = isRoot ? rootAnimateState : (parentElement.data(NG_ANIMATE_STATE) || {}); |
| 1092 | if (state.disabled) { |
| 1093 | return true; |
| 1094 | } |
| 1095 | |
| 1096 | //no matter what, for an animation to work it must reach the root element |
| 1097 | //this implies that the element is attached to the DOM when the animation is run |
| 1098 | if (isRoot) { |
| 1099 | hasParent = true; |
| 1100 | } |
| 1101 | |
| 1102 | //once a flag is found that is strictly false then everything before |
| 1103 | //it will be discarded and all child animations will be restricted |
| 1104 | if (allowChildAnimations !== false) { |
| 1105 | var animateChildrenFlag = parentElement.data(NG_ANIMATE_CHILDREN); |
| 1106 | if(angular.isDefined(animateChildrenFlag)) { |
| 1107 | allowChildAnimations = animateChildrenFlag; |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | parentRunningAnimation = parentRunningAnimation || |
| 1112 | state.running || |
| 1113 | (state.last && !state.last.isClassBased); |
| 1114 | } |
| 1115 | while(parentElement = parentElement.parent()); |
| 1116 | |
| 1117 | return !hasParent || (!allowChildAnimations && parentRunningAnimation); |
| 1118 | } |
| 1119 | }]); |
| 1120 | |
| 1121 | $animateProvider.register('', ['$window', '$sniffer', '$timeout', '$$animateReflow', |
no test coverage detected