If the default is an object, use a clone of the default value to prevent widget from accidentally changing the default by reference

This commit is contained in:
Nathan Gray 2014-05-05 17:22:25 +00:00
parent ed85cc3ce6
commit e004e23c31

View File

@ -124,7 +124,9 @@ var ClassWithAttributes = Class.extend(
_default = undefined;
}
_attrs[key] = _default;
// Use extend() to avoid a reference to default.
// Widget might change it, and alter the default
_attrs[key] = typeof _default == "object" ? jQuery.extend(true,{},_default) : _default;
}
}