diff --git a/src/basic/Rectangle.js b/src/basic/Rectangle.js index 376e7589..85d3e890 100644 --- a/src/basic/Rectangle.js +++ b/src/basic/Rectangle.js @@ -880,7 +880,7 @@ var LinkedRectangle = Rectangle.extend({ // afterwards here, only once per change. this._dontNotify = true; proto[name].apply(this, arguments); - delete this._dontNotify; + this._dontNotify = false; this._owner[this._setter](this); }; }, /** @lends Rectangle# */{ diff --git a/src/core/Base.js b/src/core/Base.js index aa6fe49c..4fd9511e 100644 --- a/src/core/Base.js +++ b/src/core/Base.js @@ -191,9 +191,9 @@ Base.inject(/** @lends Base# */{ // Have arguments.__read point to the amount of args read in the // last read() call list.__read = obj.__read; - delete obj.__read; + obj.__read = undefined; if (options) - delete obj.__options; + obj.__options = undefined; } return obj; }, @@ -491,9 +491,9 @@ Base.inject(/** @lends Base# */{ if (items) args.push.apply(args, items); var removed = list.splice.apply(list, args); - // Delete the indices of the removed items + // Erase the indices of the removed items for (var i = 0, l = removed.length; i < l; i++) - delete removed[i]._index; + removed[i]._index = undefined; // Adjust the indices of the items above. for (var i = index + amount, l = list.length; i < l; i++) list[i]._index = i; diff --git a/src/item/Group.js b/src/item/Group.js index a478221e..179bfe77 100644 --- a/src/item/Group.js +++ b/src/item/Group.js @@ -106,7 +106,7 @@ var Group = Item.extend(/** @lends Group# */{ } if (flags & (/*#=*/ ChangeFlag.HIERARCHY | /*#=*/ ChangeFlag.CLIPPING)) { // Clear cached clip item whenever hierarchy changes - delete this._clipItem; + this._clipItem = undefined; } }, diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 3b648f0d..3d6725a5 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -103,9 +103,9 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{ _changed: function _changed(flags) { _changed.base.call(this, flags); - // Delete cached native Path + // Clear cached native Path if (flags & (/*#=*/ ChangeFlag.HIERARCHY | /*#=*/ ChangeFlag.GEOMETRY)) - delete this._currentPath; + this._currentPath = undefined; }, insertChildren: function insertChildren(index, items, _preserve) { diff --git a/src/path/Curve.js b/src/path/Curve.js index 2331a317..f89cfeaf 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -98,8 +98,7 @@ var Curve = Base.extend(/** @lends Curve# */{ _changed: function() { // Clear cached values. - delete this._length; - delete this._bounds; + this._length = this._bounds = undefined; }, /** diff --git a/src/path/Path.js b/src/path/Path.js index 4eb8bd69..f8366f04 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -135,11 +135,10 @@ var Path = PathItem.extend(/** @lends Path# */{ _changed: function _changed(flags) { _changed.base.call(this, flags); if (flags & /*#=*/ ChangeFlag.GEOMETRY) { - // Delete cached native Path - delete (this._compound ? this._parent : this)._currentPath; - delete this._length; + // Clear cached native Path + (this._compound ? this._parent : this)._currentPath = undefined; // Clockwise state becomes undefined as soon as geometry changes. - delete this._clockwise; + this._length = this._clockwise = undefined; // Curves are no longer valid if (this._curves) { for (var i = 0, l = this._curves.length; i < l; i++) @@ -148,7 +147,7 @@ var Path = PathItem.extend(/** @lends Path# */{ } else if (flags & /*#=*/ ChangeFlag.STROKE) { // TODO: We could preserve the purely geometric bounds that are not // affected by stroke: _bounds.bounds and _bounds.handleBounds - delete this._bounds; + this._bounds = undefined; } }, @@ -167,7 +166,7 @@ var Path = PathItem.extend(/** @lends Path# */{ this._segments.length = 0; this._selectedSegmentState = 0; // Calculate new curves next time we call getCurves() - delete this._curves; + this._curves = undefined; this._add(Segment.readAll(segments)); if (fullySelected) this.setFullySelected(true); @@ -701,8 +700,7 @@ var Path = PathItem.extend(/** @lends Path# */{ if (segment._selectionState) this._updateSelection(segment, segment._selectionState, 0); // Clear the indices and path references of the removed segments - delete segment._index; - delete segment._path; + segment._index = segment._path = null; } // Adjust the indices of the segments above. for (var i = from, l = segments.length; i < l; i++) @@ -1144,7 +1142,7 @@ var Path = PathItem.extend(/** @lends Path# */{ segment._index = i; } // Clear curves since it all has changed. - delete this._curves; + this._curves = null; // Flip clockwise state if it's defined if (this._clockwise !== undefined) this._clockwise = !this._clockwise; diff --git a/src/path/PathItem.Boolean.js b/src/path/PathItem.Boolean.js index 0ec05826..8cae7558 100644 --- a/src/path/PathItem.Boolean.js +++ b/src/path/PathItem.Boolean.js @@ -192,7 +192,7 @@ PathItem.inject(new function() { path.remove(); } } - // Delete the proxies + // Remove the proxies path1.remove(); path2.remove(); // And then, we are done. diff --git a/src/project/Symbol.js b/src/project/Symbol.js index 7db868b5..c13b4fd9 100644 --- a/src/project/Symbol.js +++ b/src/project/Symbol.js @@ -121,7 +121,7 @@ var Symbol = Base.extend(/** @lends Symbol# */{ item = item.clone(); // Remove previous definition's reference to this symbol if (this._definition) - delete this._definition._parentSymbol; + this._definition._parentSymbol = null; this._definition = item; // Remove item from DOM, as it's embedded in Symbol now. item.remove(); diff --git a/src/style/Gradient.js b/src/style/Gradient.js index c8f58400..93bd9426 100644 --- a/src/style/Gradient.js +++ b/src/style/Gradient.js @@ -113,7 +113,7 @@ var Gradient = Base.extend(/** @lends Gradient# */{ if (index != -1) { this._owners.splice(index, 1); if (this._owners.length === 0) - delete this._owners; + this._owners = undefined; } }, @@ -142,7 +142,7 @@ var Gradient = Base.extend(/** @lends Gradient# */{ // this gradient as their owner. if (this.stops) { for (var i = 0, l = this._stops.length; i < l; i++) - delete this._stops[i]._owner; + this._stops[i]._owner = undefined; } if (stops.length < 2) throw new Error( diff --git a/src/style/Style.js b/src/style/Style.js index 8719f9bc..82826623 100644 --- a/src/style/Style.js +++ b/src/style/Style.js @@ -147,7 +147,7 @@ var Style = Base.extend(new function() { if (old != value) { if (isColor) { if (old) - delete old._owner; + old._owner = undefined; if (value && value.constructor === Color) { // Clone color if it already has an owner. // NOTE: If value is not a Color, it is only