code: function prepareForSerialization(entity) {
    var clone = entity.cloneNode(false);
    var children = entity.childNodes;
    for (var i = 0, l = children.length; i < l; i++) {
      var child = children[i];
      if (
        child.nodeType !== Node.ELEMENT_NODE ||
        (!child.hasAttribute('aframe-injected') &&
          !child.hasAttribute('data-aframe-inspector') &&
          !child.hasAttribute('data-aframe-canvas'))
      ) {
        clone.appendChild(prepareForSerialization(children[i]));
      }
    }
    optimizeComponents(clone, entity);
    return clone;
  }
docs: Returns a copy of the DOM hierarchy prepared for serialization.
  The process optimises component representation to avoid values coming from
  primitive attributes, mixins and defaults.
  
  @param {Element} entity Root of the DOM hierarchy.
  @return {Elment}        Copy of the DOM hierarchy ready for serialization.