diff --git a/src/item/Group.js b/src/item/Group.js index 25ccb517..bd4ed0a3 100644 --- a/src/item/Group.js +++ b/src/item/Group.js @@ -112,10 +112,10 @@ var Group = Item.extend(/** @lends Group# */{ // looked for yet). if (clipItem === undefined) { clipItem = null; - for (var i = 0, l = this._children.length; i < l; i++) { - var child = this._children[i]; - if (child._clipMask) { - clipItem = child; + var children = this._children; + for (var i = 0, l = children.length; i < l; i++) { + if (children[i]._clipMask) { + clipItem = children[i]; break; } } @@ -187,8 +187,9 @@ var Group = Item.extend(/** @lends Group# */{ clipItem.draw(ctx, param.extend({ clip: true })); } if (draw) { - for (var i = 0, l = this._children.length; i < l; i++) { - var item = this._children[i]; + var children = this._children; + for (var i = 0, l = children.length; i < l; i++) { + var item = children[i]; if (item !== clipItem) item.draw(ctx, param); } diff --git a/src/item/Item.js b/src/item/Item.js index 6ff1032a..38872f5e 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1596,9 +1596,10 @@ var Item = Base.extend(Emitter, /** @lends Item# */{ }, _contains: function(point) { - if (this._children) { - for (var i = this._children.length - 1; i >= 0; i--) { - if (this._children[i].contains(point)) + var children = this._children; + if (children) { + for (var i = children.length - 1; i >= 0; i--) { + if (children[i].contains(point)) return true; } return false; diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index b241db60..e8eea33b 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -136,8 +136,9 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{ }, smooth: function() { - for (var i = 0, l = this._children.length; i < l; i++) - this._children[i].smooth(); + var children = this._children; + for (var i = 0, l = children.length; i < l; i++) + children[i].smooth(); }, // DOCS: reduce() diff --git a/src/path/Path.js b/src/path/Path.js index bde3bc98..f0e5280b 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -367,9 +367,9 @@ var Path = PathItem.extend(/** @lends Path# */{ }, _transformContent: function(matrix) { - var coords = new Array(6); - for (var i = 0, l = this._segments.length; i < l; i++) - this._segments[i]._transformCoordinates(matrix, coords, true); + var coords = new Array(6), segments = this._segments; + for (var i = 0, l = segments.length; i < l; i++) + segments[i]._transformCoordinates(matrix, coords, true); return true; },