code: function (parent) {
  
              var renderer = this.renderer,
                parentWrapper = parent || renderer,
                parentNode = parentWrapper.element || renderer.box,
                childNodes,
                element = this.element,
                zIndex = this.zIndex,
                otherElement,
                otherZIndex,
                i,
                inserted;
  
              if (parent) {
                  this.parentGroup = parent;
              }
  
              // mark as inverted
              this.parentInverted = parent && parent.inverted;
  
              // build formatted text
              if (this.textStr !== undefined) {
                  renderer.buildText(this);
              }
  
              // mark the container as having z indexed children
              if (zIndex) {
                  parentWrapper.handleZ = true;
                  zIndex = pInt(zIndex);
              }
  
              // insert according to this and other elements' zIndex
              if (parentWrapper.handleZ) { // this element or any of its siblings has a z index
                  childNodes = parentNode.childNodes;
                  for (i = 0; i < childNodes.length; i++) {
                      otherElement = childNodes[i];
                      otherZIndex = attr(otherElement, 'zIndex');
                      if (otherElement !== element && (
                            // insert before the first element with a higher zIndex
                          pInt(otherZIndex) > zIndex ||
                              // if no zIndex given, insert before the first element with a zIndex
                          (!defined(zIndex) && defined(otherZIndex))
  
                        )) {
                          parentNode.insertBefore(element, otherElement);
                          inserted = true;
                          break;
                      }
                  }
              }
  
              // default: append at the end
              if (!inserted) {
                  parentNode.appendChild(element);
              }
  
              // mark as added
              this.added = true;
  
              // fire an event for internal hooks
              if (this.onAdd) {
                  this.onAdd();
              }
  
              return this;
          }
docs: Add the element
  @param {Object|Undefined} parent Can be an element, an element wrapper or undefined
  to append the element to the renderer.box.