This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngShow does not show the svg element correctly when using jquery 2.1.1 and ngAnimate at the same time #8872
Comments
merlinchen
referenced
this issue
Sep 2, 2014
…igest loop All class-based animation methods (addClass, removeClass and setClass) on $animate are now processed after the next digest occurs. This fix prevents any sequencing errors from occuring from excessive calls to $animate.addClass, $animate.remoteClass or $animate.setClass. BREAKING CHANGE $animate.addClass, $animate.removeClass and $animate.setClass will no longer start the animation right after being called in the directive code. The animation will only commence once a digest has passed. This means that all animation-related testing code requires an extra digest to kick off the animation. ```js //before this fix $animate.addClass(element, 'super'); expect(element).toHaveClass('super'); //now $animate.addClass(element, 'super'); $rootScope.$digest(); expect(element).toHaveClass('super'); ``` $animate will also tally the amount of times classes are added and removed and only animate the left over classes once the digest kicks in. This means that for any directive code that adds and removes the same CSS class on the same element then this may result in no animation being triggered at all. ```js $animate.addClass(element, 'klass'); $animate.removeClass(element, 'klass'); $rootScope.$digest(); //nothing happens... ```
@merlinchen you can just use https://github.com/kbwood/svg/blob/master/jquery.svgdom.js to monkeypatch jQuery and make it work correctly. |
@caitp Got it. Thanks. |
So this should be fixable with jQuery.svgdom, but it is awkward that this worked before and not now --- I'm going to consider this a regression unless anyone says we have a good reason to use jQuery's hasClass. |
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Sep 2, 2014
… jQuery Without this CL, ngShowHide will not work without the use of monkeypatched fixes for jQuery such as https://github.com/kbwood/svg 's jquery-svgdom.js script. Closes angular#8872
caitp
added a commit
to caitp/angular.js
that referenced
this issue
Sep 4, 2014
… jQuery Without this CL, ngShowHide will not work without the use of monkeypatched fixes for jQuery such as https://github.com/kbwood/svg 's jquery-svgdom.js script. Closes angular#8872
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
There is a regression between beta.19 and rc.0.
beta.19:http://plnkr.co/edit/zkPRL7Cu0YCFs0y25oSf?p=preview
rc.0:http://plnkr.co/edit/uL9yduQne0HMarug27Zk?p=preview
When click the toggle button, the
rect
element did not show as expected.This only happens when jquery 2.1.1 is included and
ngAnimate
is required in module definition.The text was updated successfully, but these errors were encountered: