-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($animate): silently ignore the options param if an object is not passed in #11826
Conversation
…passed in Earlier versions of Angular expected a function to be passed into the same param as the options value. This causes a nasty issue since the internal animation code expects the options value to be an object instead of a function. This patch adds the code to convert a function value into an empty object when that occurs. Closes angular#11713
Does it make sense to remove this first thing in 1.5 and add it as a breaking change? |
We can also add a deprecation notice for this. |
|
||
inject(function($animate, $rootScope, $document) { | ||
var element = $document[0].createElement('div'); | ||
element.setAttribute('id', 'crazy-man'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that left over from the previous test? The id is not used.
It looks like this callback was removed in bf0f550 This was a breaking change for 1.3.x, and it is documented as such in the commit, since if you were relying on the callback to be called this no longer happens. The question is whether we should let it slip through by merging this code. I feel bad doing so because, now instead of an error your callback just never gets called. How about we add an assertion on that parameter that says that it cannot be a |
Works for me. @petebacondarwin would be able to take this one on for me? |
@matsko: will do |
…hods As of bf0f550 (released in 1.3.0) it is no longer valid to pass a callback to the following functions: `enter`, `move`, `leave`, `addClass`, `removeClass`, `setClass` and `animate`. To prevent confusing error messages, this change asserts that this parameter is not a function. Closes angular#11826 Closes angular#11713
…hods As of bf0f550 (released in 1.3.0) it is no longer valid to pass a callback to the following functions: `enter`, `move`, `leave`, `addClass`, `removeClass`, `setClass` and `animate`. To prevent confusing error messages, this change asserts that this parameter is not a function. Closes #11826 Closes #11713
Prior to this fix there was another patch that threw an exception if the provided options value was not of an object type. While this is correct in terms of logic, it caused issues with plugins and tools that are designed to work with multiple version of Angular. This fix ensures that these plugins work since an invalid options value is ignored by `$animate`. Closes angular#11826
Prior to this fix there was another patch that threw an exception if the provided options value was not of an object type. While this is correct in terms of logic, it caused issues with plugins and tools that are designed to work with multiple version of Angular. This fix ensures that these plugins work since an invalid options value is ignored by `$animate`. Closes angular#11826
Prior to this fix there was another patch that threw an exception if the provided options value was not of an object type. While this is correct in terms of logic, it caused issues with plugins and tools that are designed to work with multiple version of Angular. This fix ensures that these plugins work since an invalid options value is ignored by `$animate`. Closes #11826
Prior to this fix there was another patch that threw an exception if the provided options value was not of an object type. While this is correct in terms of logic, it caused issues with plugins and tools that are designed to work with multiple version of Angular. This fix ensures that these plugins work since an invalid options value is ignored by `$animate`. Closes #11826
Note that we had to revert this and add the 1.3 behaviour of ignoring non-object properties since UI-router, AngularStrap and other libraries still rely on it. This commit makes the change: |
…hods As of bf0f550 (released in 1.3.0) it is no longer valid to pass a callback to the following functions: `enter`, `move`, `leave`, `addClass`, `removeClass`, `setClass` and `animate`. To prevent confusing error messages, this change asserts that this parameter is not a function. Closes angular#11826 Closes angular#11713
Prior to this fix there was another patch that threw an exception if the provided options value was not of an object type. While this is correct in terms of logic, it caused issues with plugins and tools that are designed to work with multiple version of Angular. This fix ensures that these plugins work since an invalid options value is ignored by `$animate`. Closes angular#11826
Earlier versions of Angular expected a function to be passed into the
same param as the options value. This causes a nasty issue since the
internal animation code expects the options value to be an object
instead of a function. This patch adds the code to convert a function
value into an empty object when that occurs.
Closes #11713