Skip to content

Instantly share code, notes, and snippets.

@matsko
Created October 26, 2013 14:23
Show Gist options
  • Save matsko/7170010 to your computer and use it in GitHub Desktop.
Save matsko/7170010 to your computer and use it in GitHub Desktop.
function animationsDisabled(element, parent) {
if(element == $rootElement) {
return rootAnimateState.disabled || rootAnimateState.running;
}
var validState;
do {
//the element did not reach the root element which means that it
//is not apart of the DOM. Therefore there is no reason to do
//any animations on it
if(parent.length === 0) return true;
var isDoc = parent[0] == $document[0];
var state = isDoc ? rootAnimateState : parent.data(NG_ANIMATE_STATE);
if(state && (state.disabled != null || state.running != null)) {
validState = state;
break;
}
if(isDoc) return true;
}
while(parent = parent.parent());
return validState ? (validState.disabled || validState.running) : true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment