Introduce private Item#_clone(copy), so subclasses can override the way the copy is actually produced, e.g. providing parameters to the constructor.

This commit is contained in:
Jürg Lehni 2011-05-20 08:50:09 +01:00
parent fd8ceb9641
commit 87d340e525

View file

@ -30,7 +30,10 @@ var Item = this.Item = Base.extend({
* @return the newly cloned item
*/
clone: function() {
var copy = new this.constructor();
return this._clone(new this.constructor());
},
_clone: function(copy) {
// Copy over style
copy.setStyle(this._style);
// If this item has children, clone and append each of them: