Add the element to its parent
167810
@Override
    public void processElement(Wrapper<Element> element) {
        activeElement = element.getContent();
        
        if (parentElement != null) {
            parentElement.addContent(activeElement);
        }
    }
1065123
function (element) {
      var parent = element.parent();

      // jqLite might return a non-null, but still empty, parent; so check for parent and length
      while (hasComputedStyle(parent, 'pointer-events', 'none')) {
        parent = parent.parent();
      }

      return parent;
    }
1335225
function addChild(child, node) {
    var children = node.children;
    if (child.parentNode === node) {
        return;
    }

    children.push(child);
    child.parentNode = node;
}
1363408
public void bringToFront(Object parent, String name) {
		Element parentElement = getGroup(parent);
		if (parentElement == null) {
			throw new IllegalArgumentException("bringToFront failed: could not find parent group.");
		}

		Element element = getElement(parent, name);
		if (element == null) {
			throw new IllegalArgumentException("bringToFront failed: could not find element within group.");
		}
		if (parentElement.getLastChild() != element) {
			parentElement.appendChild(element);
		}
	}
780704
function insertAt(parent, index, html) {
  console.log('inserting at ' + index + ' ' + html);
  console.log(parent);
  if (index === 0)
    return parent.prepend(html);
  parent.children(':nth-child(' + index + ')').after(html);
}
96522
def _add_element(self, element, parent_node):
        
        if element.tag == 'unit':
            element_node_id = element.attrib['id']+':'+element.attrib['type']
            node_layers = {self.ns, self.ns+':unit', self.ns+':'+element.attrib['type']}
        elif element.tag == 'connective':
            element_node_id = element.attrib['id']+':connective'
            node_layers = {self.ns, self.ns+':connective'}
        elif element.tag == 'discourse':
            element_node_id = 'discourse'
            node_layers = {self.ns}
        else:  # <modifier>
            element_node_id = element.getparent().attrib['id']+':'+element.tag
            node_layers = {self.ns, self.ns+':modifier'}

        self.add_node(element_node_id, layers=node_layers)
        self.add_edge(parent_node, element_node_id, layers={self.ns},
                      edge_type=EdgeTypes.dominance_relation)

        if element.text:
            if self.tokenize:
                for token in element.text.split():
                    self._add_token(token, element_node_id)
            else:
                element_text = sanitize_string(element.text)
                self.node[element_node_id].update(
                    {'label': u"{0}: {1}...".format(element_node_id,
                                                   element_text[:20])})


        for child_element in element.iterchildren():
            self._add_element(child_element, element_node_id)

        if element.tail:  # tokens _after_ the </element> closes
            if self.tokenize:
                for token in element.tail.split():
                    self._add_token(token, parent_node)
            else:
                tail_text = sanitize_string(element.tail)
                self.node[parent_node].update(
                    {'label': u"{0}: {1}...".format(parent_node,
                                                    tail_text[:20])})
912205
def _element_get_or_add_from_parent(
        parent,  # type: ET.Element
        element_path  # type: Text
):
    # type: (...) -> ET.Element
    
    element_names = element_path.split('/')

    # Starting from the parent, walk the element path until we find the first element in the path
    # that does not exist. Create that element and all the elements following it in the path. If
    # all elements along the path exist, then we will simply walk the full path to the final
    # element we want to return.
    existing_element = None
    previous_element = parent
    for i, element_name in enumerate(element_names):
        existing_element = previous_element.find(element_name)
        if existing_element is None:
            existing_element = _element_append_path(previous_element, element_names[i:])
            break

        previous_element = existing_element

    assert existing_element is not None
    return existing_element
127208
def add_child(self, node):
        """"""
        node._parent = self
        self._children.append(node)
184192
function() {
   
      // Create the DIV element
      this.el = WireIt.cn('div', {className: this.className} );
      if(this.name) { this.el.title = this.name; }

      // Set the offset position
      this.setPosition(this.offsetPosition);
   
      // Append the element to the parent
      this.parentEl.appendChild(this.el);
   }
329689
function parent(/*selector*/) {
  var arr = [], $ = this.air, slice = this.slice;
  this.each(function(el) {
    arr = arr.concat(slice.call($(el.parentNode).dom));
  });
  return $(arr);
}
1340623
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;
        }
154630
def parent_element(self):
        
        def parent_element():
            """
            Wrapper to get parent element
            """
            parent = self.driver_wrapper.execute_script('return arguments[0].parentNode;', self.element)
            wrapped_parent = WebElementWrapper(self.driver_wrapper, '', parent)
            return wrapped_parent

        return self.execute_and_handle_webelement_exceptions(parent_element, 'get parent element')
772382
void appendEndElement()
  {
    // pop up the stacks

    if (previousSiblingWasParent)
      nodes.writeEntry(previousSibling, 2, NULL);

    // Pop parentage
    previousSibling = currentParent;
    nodes.readSlot(currentParent, gotslot);
    currentParent = gotslot[1] & 0xFFFF;

    // The element just being finished will be
    // the previous sibling for the next operation
    previousSiblingWasParent = true;

    // Pop a level of namespace table
    // namespaceTable.removeLastElem();
  }
25193
GroupElement set_parent(final GroupElement _parent) {
	final GroupElement previous_parent = parent;
	parent = _parent;
	return previous_parent;
    }
574994
def replaceelement(oldelem, newelem):
    '''
    
    '''
    parent = oldelem.getparent()
    if parent is not None:
        size = len(parent.getchildren())
        for x in range(0, size):
            if parent.getchildren()[x] == oldelem:
                parent.remove(oldelem)
                parent.insert(x, newelem)
1164705
def add_child(self, child):
        '''
        '''
        if not isinstance(child, Node):
            raise TypeError("child must be a Node")
        self.children.append(child); child.parent = self
254582
def add_node(node, parent):
    '''
    '''
    newNode = dict(node_id=node.id, children=[])
    parent["children"].append(newNode)
    if node.left: add_node(node.left, newNode)
    if node.right: add_node(node.right, newNode)