diff --git a/src/item/Item.js b/src/item/Item.js index 6b971617..1b348d8c 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -1956,6 +1956,7 @@ var Item = Base.extend(Callback, /** @lends Item# */{ * Removes all of the item's {@link #children} (if any). * * @name Item#removeChildren + * @alias Item#clear * @function * @return {Item[]} an array containing the removed items */ @@ -1985,6 +1986,8 @@ var Item = Base.extend(Callback, /** @lends Item# */{ return removed; }, + clear: '#removeChildren', + /** * Reverses the order of the item's children */ diff --git a/src/path/Path.js b/src/path/Path.js index 63606105..51618f1a 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -635,6 +635,7 @@ var Path = PathItem.extend(/** @lends Path# */{ * Removes all segments from the path's {@link #segments} array. * * @name Path#removeSegments + * @alias Path#clear * @function * @return {Segment[]} an array containing the removed segments */ @@ -707,6 +708,8 @@ var Path = PathItem.extend(/** @lends Path# */{ return removed; }, + clear: '#removeSegments', + /** * Specifies whether an path is selected and will also return {@code true} * if the path is partially selected, i.e. one or more of its segments is diff --git a/src/path/PathItem.js b/src/path/PathItem.js index 8aa9564a..ef492cc9 100644 --- a/src/path/PathItem.js +++ b/src/path/PathItem.js @@ -108,10 +108,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{ } // First clear the previous content - if (this._type === 'path') - this.removeSegments(); - else - this.removeChildren(); + this.clear(); for (var i = 0, l = parts.length; i < l; i++) { var part = parts[i],