``<a:defRPr>`` element of required first ``p`` child, added with its
        ancestors if not present. Used when element is a ``<c:txPr>`` in
        a chart and the ``p`` element is used only to specify formatting, not
        content.
518828
def defRPr(self):
        
        p = self.p_lst[0]
        pPr = p.get_or_add_pPr()
        defRPr = pPr.get_or_add_defRPr()
        return defRPr
1278133
def _requirement_element(self, parent_element, req_data):
        """"""
        req_data = self._transform_result(req_data)
        if not req_data:
            return

        title = req_data.get("title")
        if not title:
            logger.warning("Skipping requirement, title is missing")
            return
        req_id = req_data.get("id")

        if not self._check_lookup_prop(req_id):
            logger.warning(
                "Skipping requirement `%s`, data missing for selected lookup method", title
            )
            return

        attrs, custom_fields = self._classify_data(req_data)
        attrs, custom_fields = self._fill_defaults(attrs, custom_fields)

        # For testing purposes, the order of fields in resulting XML
        # needs to be always the same.
        attrs = OrderedDict(sorted(attrs.items()))
        custom_fields = OrderedDict(sorted(custom_fields.items()))

        requirement = etree.SubElement(parent_element, "requirement", attrs)

        title_el = etree.SubElement(requirement, "title")
        title_el.text = title

        description = req_data.get("description")
        if description:
            description_el = etree.SubElement(requirement, "description")
            description_el.text = description

        self._fill_custom_fields(requirement, custom_fields)
1195769
def firstElementChild(self) -> Optional[AbstractNode]:
        
        for child in self.childNodes:
            if child.nodeType == Node.ELEMENT_NODE:
                return child
        return None
1308019
def _insert_paragraph_before(self):
        
        p = self._p.add_p_before()
        return Paragraph(p, self._parent)
118396
def removeUnusedAttributesOnParent(elem):
    
    num = 0

    childElements = []
    # recurse first into the children (depth-first)
    for child in elem.childNodes:
        if child.nodeType == Node.ELEMENT_NODE:
            childElements.append(child)
            num += removeUnusedAttributesOnParent(child)

    # only process the children if there are more than one element
    if len(childElements) <= 1:
        return num

    # get all attribute values on this parent
    attrList = elem.attributes
    unusedAttrs = {}
    for index in range(attrList.length):
        attr = attrList.item(index)
        if attr.nodeName in ['clip-rule',
                             'display-align',
                             'fill', 'fill-opacity', 'fill-rule',
                             'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch',
                             'font-style', 'font-variant', 'font-weight',
                             'letter-spacing',
                             'pointer-events', 'shape-rendering',
                             'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin',
                             'stroke-miterlimit', 'stroke-opacity', 'stroke-width',
                             'text-anchor', 'text-decoration', 'text-rendering', 'visibility',
                             'word-spacing', 'writing-mode']:
            unusedAttrs[attr.nodeName] = attr.nodeValue

    # for each child, if at least one child inherits the parent's attribute, then remove
    for childNum in range(len(childElements)):
        child = childElements[childNum]
        inheritedAttrs = []
        for name in unusedAttrs:
            val = child.getAttribute(name)
            if val == '' or val is None or val == 'inherit':
                inheritedAttrs.append(name)
        for a in inheritedAttrs:
            del unusedAttrs[a]

    # unusedAttrs now has all the parent attributes that are unused
    for name in unusedAttrs:
        elem.removeAttribute(name)
        num += 1

    return num
1249742
protected void insertAtPreferredLocation(Element parent, Element child, Counter counter)
   {
      int contentIndex = 0;
      int elementCounter = 0;
      Iterator it = parent.getContent().iterator();
      Text lastText = null;
      int offset = 0;
      while (it.hasNext() && (elementCounter <= counter.getCurrentIndex()))
      {
         Object next = it.next();
         offset = offset + 1;
         if (next instanceof Element)
         {
            elementCounter = elementCounter + 1;
            contentIndex = contentIndex + offset;
            offset = 0;
         }
         if ((next instanceof Text) && it.hasNext())
         {
            lastText = (Text) next;
         }
      }
      if ((lastText != null) && (lastText.getTextTrim().length() == 0))
      {
         lastText = (Text) lastText.clone();
      }
      else
      {
         StringBuilder starter = new StringBuilder(lineSeparator);
         for (int i = 0; i < counter.getDepth(); i++)
         {
            starter.append("  "); // TODO make settable?
         }
         lastText = factory.text(starter.toString());
      }
      if (parent.getContentSize() == 0)
      {
         Text finalText = (Text) lastText.clone();
         finalText.setText(finalText.getText().substring(0, finalText.getText().length() - "  ".length()));
         parent.addContent(contentIndex, finalText);
      }
      parent.addContent(contentIndex, child);
      parent.addContent(contentIndex, lastText);
   }
1317386
function forEls(parent, fn) {
    let i = 0;
    let child = parent.firstElementChild;
    while (child) {
        fn(child, i++);
        child = child.nextElementSibling;
    }
}
501337
def set_element_tail(parent_to_parse, element_path=None, element_tail=u''):
    

    return _set_element_property(parent_to_parse, element_path, _ELEM_TAIL, element_tail)
15906
def p_expr1(p):
    
    p[0] = node.expr(op=p[1], args=node.expr_list([p[2]]))
769763
function ( child, index ) {
            var el = this.element();
            if ( typeof index === 'number' ) {
                var children = el.children,
                    childNum = children.length;
    
                if ( childNum > 0 && index < childNum ) {
                    el.insertBefore( child, children[index] );
                    return;
                }
            }
            el.appendChild( child );
        }
50032
def _pfp__add_child(self, name, child, stream=None):
        
        res = super(Union, self)._pfp__add_child(name, child)
        self._pfp__buff.seek(0, 0)
        child._pfp__build(stream=self._pfp__buff)
        size = len(self._pfp__buff.getvalue())
        self._pfp__buff.seek(0, 0)

        if stream is not None:
            curr_pos = stream.tell()
            stream.seek(curr_pos-size, 0)

        return res
384245
function(parent, count)
	{
		count = count || 1;
		var br = null;
		
		for (var i = 0; i < count; i++)
		{
			if (parent != null)
			{
				br = parent.ownerDocument.createElement('br');
				parent.appendChild(br);
			}
		}
		
		return br;
	}
532542
Rule pieDescriptor() {
        return NodeSequence(
                pieType(),
                push(new PieNode()),
                ZeroOrMore(Sequence(pieElement(), Newline())),
                ANY);
    }
1088355
long getPrimaryAfter(long p, int index, boolean isCompressible) {
        assert(p == (elements[index] & 0xffffff00L) || isEndOfPrimaryRange(elements[index + 1]));
        long q = elements[++index];
        int step;
        if((q & SEC_TER_DELTA_FLAG) == 0 && (step = (int)q & PRIMARY_STEP_MASK) != 0) {
            // Return the next primary in this range.
            if((p & 0xffff) == 0) {
                return Collation.incTwoBytePrimaryByOffset(p, isCompressible, step);
            } else {
                return Collation.incThreeBytePrimaryByOffset(p, isCompressible, step);
            }
        } else {
            // Return the next primary in the list.
            while((q & SEC_TER_DELTA_FLAG) != 0) {
                q = elements[++index];
            }
            assert((q & PRIMARY_STEP_MASK) == 0);
            return q;
        }
    }
53595
int findPrimary(long p) {
        // Requirement: p must occur as a root primary.
        assert((p & 0xff) == 0);  // at most a 3-byte primary
        int index = findP(p);
        // If p is in a range, then we just assume that p is an actual primary in this range.
        // (Too cumbersome/expensive to check.)
        // Otherwise, it must be an exact match.
        assert(isEndOfPrimaryRange(elements[index + 1]) || p == (elements[index] & 0xffffff00L));
        return index;
    }
150424
function(child, position) {
			child = child || new AbbreviationNode();
			child.parent = this;
			
			if (typeof position === 'undefined') {
				this.children.push(child);
			} else {
				this.children.splice(position, 0, child);
			}
			
			return child;
		}
366593
def add_child(parent, tag, text=None):
    
    elem = ET.SubElement(parent, tag)
    if text is not None:
        elem.text = text
    return elem