mootools/mootools-core — Issue #2119: Element.clone could have a cloneStorage option, and more!
Author: fabiomcosta
Created: 2011-11-04 16:47:44+00:00
State: open
Labels: enhancement

The clone function could be improved to receive only one options object so we could improve its readability:

**contents**

current: `element.clone(true)`
proposed: `element.clone({contents: true})`

**keepid**

current: `element.clone(false, true)`
proposed: `element.clone({keepid: true})`

**events**

current: `not possible`
proposed: `element.clone({events: true})`

**storage**

current: `not possible`
proposed: `element.clone({storage: true})`

**mixed, keepid and contents (more readable, no [boolean traps](http://ariya.ofilabs.com/2011/08/hall-of-api-shame-boolean-trap.html))**

current: `element.clone(true, true)`
proposed: `element.clone({contents: true, keepid: true})`