Used to get component DOI from a tag and confirm it is actually for that tag
    and it is not for one of its children in the list of nodenames
182758
def extract_component_doi(tag, nodenames):
    
    component_doi = None

    if(tag.name == "sub-article"):
        component_doi = doi_uri_to_doi(node_text(first(raw_parser.article_id(tag, pub_id_type= "doi"))))
    else:
        object_id_tag = first(raw_parser.object_id(tag, pub_id_type= "doi"))
        # Tweak: if it is media and has no object_id_tag then it is not a "component"
        if tag.name == "media" and not object_id_tag:
            component_doi = None
        else:
            # Check the object id is for this tag and not one of its children
            #   This happens for example when boxed text has a child figure,
            #   the boxed text does not have a DOI, the figure does have one
            if object_id_tag and first_parent(object_id_tag, nodenames).name == tag.name:
                component_doi = doi_uri_to_doi(node_text(object_id_tag))

    return component_doi
1320065
def getnodefieldname(idfobject, endswith, fluid=None, startswith=None):
    """"""
    if startswith is None:
        startswith = ''
    if fluid is None:
        fluid = ''
    nodenames = getfieldnamesendswith(idfobject, endswith)
    nodenames = [name for name in nodenames if name.startswith(startswith)]
    fnodenames = [nd for nd in nodenames if nd.find(fluid) != -1]
    fnodenames = [name for name in fnodenames if name.startswith(startswith)]
    if len(fnodenames) == 0:
        nodename = nodenames[0]
    else:
        nodename = fnodenames[0]
    return nodename
851307
function(one, two) {
        if (one.tag != two.tag) {
            return false;
        } else if (one.text.trim() != two.text.trim()) {
            return false;
        } else if (one._children.length != two._children.length) {
            return false;
        }

        if (!attribMatch(one, two)) return false;

        for (var i = 0; i < one._children.length; i++) {
            if (!module.exports.equalNodes(one._children[i], two._children[i])) {
                return false;
            }
        }

        return true;
    }
1198472
function TagList(props: Props): React.Node {
  const { children, className } = props;
  const classes = cn("tags", className);
  return <div className={classes}>{children}</div>;
}
1198781
function findComponents(nodes, callback) {
  nodes = toArray(nodes);
  nodes = [].slice.call(nodes);
  var node;

  for (var i = 0, l = nodes.length; i < l; i++) {
    node = nodes[i];

    if (node && node.hasAttribute && node.hasAttribute('data-component')) {
      callback(node);
    } else if (node.childNodes && node.childNodes.length) {
      findComponents([].slice.call(node.childNodes), callback);
    }
  }
}
1303200
def tag_details(tag, nodenames):
    
    details = {}

    details['type'] = tag.name
    details['ordinal'] = tag_ordinal(tag)

    # Ordinal value
    if tag_details_sibling_ordinal(tag):
        details['sibling_ordinal'] = tag_details_sibling_ordinal(tag)

    # Asset name
    if tag_details_asset(tag):
        details['asset'] = tag_details_asset(tag)

    object_id_tag = first(raw_parser.object_id(tag, pub_id_type= "doi"))
    if object_id_tag:
        details['component_doi'] = extract_component_doi(tag, nodenames)

    return details
425027
function() {
    var c=[], ce=this.childElements, celts=this.ctlElements, eltType;
    if (ce && ce.length) {
      for (var i=0, sz=ce.length;sz>i;i++) {
        eltType=celts[ce[i].name].type;
        if (eltType==="component") {
          c.push(ce[i].controller);
        } else if (eltType==="template") {
          c.push(ce[i]);
        } else {
          log.error(this+" Invalid element type: "+eltType);
        }
      }
    }
    return c.length>0? c : null;
  }
1197190
function getChildByName(node, name) {
                return node.getChildMeshes(false, function (n) { return n.name === name; })[0];
            }
508591
private static UIComponent getChild(
            UIComponentClassicTagBase tag, UIComponent component, String componentId)
    {
        int childCount = component.getChildCount();

        // we only need to bother to check if we even have children
        if (childCount > 0)
        {
            List<UIComponent> children = component.getChildren();

            // Most Lists implement RandomAccess, so iterate directly rather than creating
            // and iterator
            if (children instanceof RandomAccess)
            {
                // in the most common case, the first component we are asked for will be the
                // our first child, the second, our second, etc.  Take advantage of this by
                // remembering the index to check for the next child.  This changes this code
                // from O(n^2) for all of the children to O(n)
                int startIndex;

                if (tag != null)
                    startIndex = tag._nextChildIndex;
                else
                    startIndex = 0;

                // start searching from location remembered from last time
                for (int i = startIndex; i < childCount; i++)
                {
                    UIComponent child = children.get(i);

                    if (componentId.equals(child.getId()))
                    {
                        // bump up the index to search next and wrap around
                        i++;

                        tag._nextChildIndex = (i < childCount) ? i : 0;
                        return child;
                    }
                }

                // handle case where we started past the first item and didn't find our
                // child.  Now search from the beginning to where we started
                if (startIndex > 0)
                {
                    for (int i = 0; i < startIndex; i++)
                    {
                        UIComponent child = children.get(i);

                        if (componentId.equals(child.getId()))
                        {
                            i++;

                            tag._nextChildIndex = i;
                            return child;
                        }
                    }
                }
            }
            else
            {
                // List doesn't support RandomAccess, do it the iterator way
                for (UIComponent child : children)
                {
                    if (componentId.equals(child.getId()))
                        return child;
                }
            }
        }

        return null;
    }
556310
function getDomNode(node, start, ltr, startFromChild, fn, guard) {
    var tmpNode = startFromChild && node[start],
        parent;
    !tmpNode && (tmpNode = node[ltr]);
    while (!tmpNode && (parent = (parent || node).parentNode)) {
        if (parent.tagName == 'BODY' || guard && !guard(parent)) {
            return null;
        }
        tmpNode = parent[ltr];
    }
    if (tmpNode && fn && !fn(tmpNode)) {
        return  getDomNode(tmpNode, start, ltr, false, fn);
    }
    return tmpNode;
}
762473
def element_info(cls_or_slf, node, siblings, level, value_dims):
        
        info = cls_or_slf.component_type(node)
        if len(node.kdims) >= 1:
            info += cls_or_slf.tab + '[%s]' % ','.join(d.name for d in node.kdims)
        if value_dims and len(node.vdims) >= 1:
            info += cls_or_slf.tab + '(%s)' % ','.join(d.name for d in node.vdims)
        return level, [(level, info)]
757709
def get_children_of(self, component, kind=None):
        

        structure, trace, item = self._get_structure_and_trace(component)
        item_kind, item_label = item.split(':')

        if isinstance(kind, str):
            kind = [kind]

        if item_kind not in ['orbit']:
            # return None
            return []
        else:
            items = self._get_by_trace(structure, trace[:-1]+[trace[-1]+1])
            # we want to ignore suborbits
            #return [str(ch.split(':')[-1]) for ch in items if isinstance(ch, unicode)]
            return [str(ch.split(':')[-1]) for ch in items if isinstance(ch, unicode) and (kind is None or ch.split(':')[0] in kind)]
397090
function checkChildren( children, newParentName ) {
		var allowed = DTD[ newParentName ];

		for ( var i = 0, l = children.length, child; i < l; ++i ) {
			child = children[ i ];
			if ( child.type == CKEDITOR.NODE_ELEMENT && !allowed[ child.name ] )
				return false;
		}

		return true;
	}
655855
function getTextNodeID(textNode) {
        var childIndex = textNode.parent.children.indexOf(textNode);
        if (childIndex === 0) {
            return textNode.parent.tagID + ".0";
        }
        return textNode.parent.children[childIndex - 1].tagID + "t";
    }
1054015
def get_node_name_from_id(node_id, nodes):
        
        node_name = ''
        for node in nodes:
            if node['id'] == node_id:
                node_name = node['properties']['name']
                break
        return node_name
371061
function (root, tagName) {
    var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
    if (all.length !== 1) {
      throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
    }
    return all[0];
  }
618707
def object_id_doi(tag, parent_tag_name=None):
    """"""
    doi = None
    object_id = None
    object_ids = raw_parser.object_id(tag, "doi")
    if object_ids:
        object_id = first([id_ for id_ in object_ids])
    if parent_tag_name and object_id and object_id.parent.name != parent_tag_name:
        object_id = None
    if object_id:
        doi = node_contents_str(object_id)
    return doi