Further optimise PathStyle code.

This commit is contained in:
Jürg Lehni 2011-05-05 00:08:55 +01:00
parent 23a29ced98
commit 7334e824f5

View file

@ -48,15 +48,16 @@ var PathStyle = this.PathStyle = Base.extend(new function() {
};
Item.inject(Base.each(keys, function(key) {
var isColor = !!(key.match(/Color$/)),
set = 'set' + Base.capitalize(key),
get = 'get' + Base.capitalize(key);
var isColor = !!key.match(/Color$/),
part = Base.capitalize(key),
set = 'set' + part,
get = 'get' + part;
fields[set] = function(value) {
if (this._item && this._item.children) {
for (var i = 0, l = this._item.children.length; i < l; i++) {
this._item.children[i]._style[set](value);
}
var children = this._item && this._item.children;
if (children) {
for (var i = 0, l = children.length; i < l; i++)
children[i]._style[set](value);
} else {
this['_' + key] = isColor ? Color.read(arguments) : value;
}