diff options
| author | Matias Niemelä | 2013-07-29 16:24:05 -0400 | 
|---|---|---|
| committer | Misko Hevery | 2013-07-29 21:22:05 -0700 | 
| commit | 33d45d8fafb5abf99e6fd811cad1dd57daab918b (patch) | |
| tree | 8ef5c79064f6a04f1b2700c404644ea47651ffd4 /src | |
| parent | 419ed040b6004909a22e96bfe1bc95c5aa0f38db (diff) | |
| download | angular.js-33d45d8fafb5abf99e6fd811cad1dd57daab918b.tar.bz2 | |
fix(ngClass): ensure ngClass doesn't fire addClass or removeClass with an empty string
If ngClass fires off an add- or removeClass whilst the opposite animation is going on then
the animation will be skipped. The default behavior of ngClass was executing remoteClass
with an empty string while addClass had just fired. This commit fixes that bug.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ng/directive/ngClass.js | 10 | 
1 files changed, 8 insertions, 2 deletions
| diff --git a/src/ng/directive/ngClass.js b/src/ng/directive/ngClass.js index a5b2acb6..0c4d23f0 100644 --- a/src/ng/directive/ngClass.js +++ b/src/ng/directive/ngClass.js @@ -42,12 +42,18 @@ function classDirective(name, selector) {          function removeClass(classVal) { -          $animate.removeClass(element, flattenClasses(classVal)); +          classVal = flattenClasses(classVal); +          if(classVal && classVal.length > 0) { +            $animate.removeClass(element, classVal); +          }          }          function addClass(classVal) { -          $animate.addClass(element, flattenClasses(classVal)); +          classVal = flattenClasses(classVal); +          if(classVal && classVal.length > 0) { +            $animate.addClass(element, classVal); +          }          }          function flattenClasses(classVal) { | 
