Define Item#clear() as an alias for Item#removeChildren(), or Path#removeSegments() for paths.

This commit is contained in:
Jürg Lehni 2013-11-01 17:52:27 +01:00
parent df80eb2f23
commit 132f54d362
3 changed files with 7 additions and 4 deletions

View file

@ -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
*/

View file

@ -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

View file

@ -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],