code: function(opt) {
  
          opt = opt || {};
  
          if (!opt.deep) {
              // Shallow cloning.
  
              var clone = Backbone.Model.prototype.clone.apply(this, arguments);
              // We don't want the clone to have the same ID as the original.
              clone.set('id', joint.util.uuid());
              // A shallow cloned element does not carry over the original embeds.
              clone.unset('embeds');
              // And can not be embedded in any cell
              // as the clone is not part of the graph.
              clone.unset('parent');
  
              return clone;
  
          } else {
              // Deep cloning.
  
              // For a deep clone, simply call `graph.cloneCells()` with the cell and all its embedded cells.
              return joint.util.toArray(joint.dia.Graph.prototype.cloneCells.call(null, [this].concat(this.getEmbeddedCells({ deep: true }))));
          }
      }
docs: Isolated cloning. Isolated cloning has two versions: shallow and deep (pass `{ deep: true }` in `opt`). Shallow cloning simply clones the cell and returns a new cell with different ID. Deep cloning clones the cell and all its embedded cells recursively.