Bug fix for getAttr function

Now it permits to return user defined attributes which do not have a corresponding method, similar to setAttrs(config) that sets attributes as key-value whenever there is no method for the given key
This commit is contained in:
aniruddha-loya 2013-04-24 10:19:41 +03:00
parent a09908b4a5
commit a71d3e1fa0

View File

@ -168,7 +168,13 @@
*/
getAttr: function(attr) {
var method = GET + Kinetic.Type._capitalize(attr);
return this[method]();
if(Kinetic.Type._isFunction(this[method])) {
return this[method]();
}
// otherwise get directly
else {
return this.attrs[attr];
}
},
/**
* get attrs