diff options
| author | Matias Niemelä | 2013-12-16 15:45:57 -0500 |
|---|---|---|
| committer | Matias Niemelä | 2013-12-19 16:37:29 -0500 |
| commit | cef084ade9072090259d8c679751cac3ffeaed51 (patch) | |
| tree | fe42b514dbbbdd893122fa3f7c7d647afba676b7 /src/ngAnimate/animate.js | |
| parent | 937caab6475e53a7ea0206e992f8a52449232e78 (diff) | |
| download | angular.js-cef084ade9072090259d8c679751cac3ffeaed51.tar.bz2 | |
feat(ngAnimate): provide configuration support to match specific className values to trigger animations
Closes #5357
Closes #5283
Diffstat (limited to 'src/ngAnimate/animate.js')
| -rw-r--r-- | src/ngAnimate/animate.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/ngAnimate/animate.js b/src/ngAnimate/animate.js index 16d0aa0d..08c088e9 100644 --- a/src/ngAnimate/animate.js +++ b/src/ngAnimate/animate.js @@ -288,6 +288,13 @@ angular.module('ngAnimate', ['ng']) }); }); + var classNameFilter = $animateProvider.classNameFilter(); + var isAnimatableClassName = !classNameFilter + ? function() { return true; } + : function(className) { + return classNameFilter.test(className); + }; + function lookup(name) { if (name) { var matches = [], @@ -569,17 +576,20 @@ angular.module('ngAnimate', ['ng']) and the onComplete callback will be fired once the animation is fully complete. */ function performAnimation(animationEvent, className, element, parentElement, afterElement, domOperation, doneCallback) { - var node = extractElementNode(element); + var currentClassName, classes, node = extractElementNode(element); + if(node) { + currentClassName = node.className; + classes = currentClassName + ' ' + className; + } + //transcluded directives may sometimes fire an animation using only comment nodes //best to catch this early on to prevent any animation operations from occurring - if(!node) { + if(!node || !isAnimatableClassName(classes)) { fireDOMOperation(); closeAnimation(); return; } - var currentClassName = node.className; - var classes = currentClassName + ' ' + className; var animationLookup = (' ' + classes).replace(/\s+/g,'.'); if (!parentElement) { parentElement = afterElement ? afterElement.parent() : element.parent(); |
