neon-animation
neon-animation copied to clipboard
[neon-animatable-behavior.html] - Issue with getAnimationConfig
Inside _runAnimationEffects I am having an issue where anytime I animate my polymer object I get a console warning saying:
action-buttons-menu: not found!
After doing some debugging, I traced the source to getAnimationConfig in neon-animatable-behaviour.html where it is running the following code at line 148.
getAnimationConfig: function(type) {
var map = [];
var allConfigs = [];
this._getAnimationConfigRecursive(type, map, allConfigs);
// append the configurations saved in the map to the array
for (var key in map) {
allConfigs.push(map[key]);
}
return allConfigs;
}
Normally this would run fine. However, I have a simple function on the Array object to give me an easy conditional when searching arrays.
Array.prototype.contains = function (item) {
return this.indexOf(item) !== -1;
};
When getAnimationConfig iterates through the map, it finds the contains function and believes it to be an animation config that needs to be used later in _runAnimationEffects.
Should I remove the function I added to Array?
Actually, when looking a little closer, it seems that there is a minor typo. In getAnimationConfig, why is our map an array, when _getAnimationConfigRecursive adds each item as a key, which would imply the map is a generic Object (neon-animatable-behavior line 127)?
If line 144 in neon-animatable-behavior is replaced with:
var map = {};
This should resolve the issue.
Thanks for reporting, I will take a look.