Get an array of child *elements*, skipping text and comment nodes
325149
function(filterFunc) {
    filterFunc = filterFunc || goog.functions.TRUE;
    return function(root, ret, bag) {
      var te, x = 0, tret = root[childNodesName];
      while (te = tret[x++]) {
        if (
          simpleNodeTest(te) &&
          (!bag || _isUnique(te, bag)) &&
          (filterFunc(te, x))
        ) {
          ret.push(te);
        }
      }
      return ret;
    };
  }
780196
function transferChildren(fromElement, toElement) {
  // Include comment nodes. Convert to array because the NodeList is "live"
  // and will be updated when an element is removed from it.
  const frag = document.createDocumentFragment();
  const children = Array.from(fromElement.childNodes);

  for (let i = 0; i < children.length; i++) {
    if (children[i].nodeName !== 'NOSCRIPT') {
      frag.appendChild(children[i]);
    }
  }

  toElement.appendChild(frag);
}
29359
def iterparse(source, events=('end',), remove_comments=True, **kw):
    """"""
    return ElementTree.iterparse(source, events, SourceLineParser(), **kw)
448447
function getNthIndex(node)
{
	var child,i;
	var count = 0;
	var parentsChildren = node.parentNode.childNodes;
	var numParentsChildren = parentsChildren.length;
	
	for (i=0; i<numParentsChildren; i++)
	{
		child = parentsChildren[i];
		
		if (child !== node)
		{
			// Exclude text and comments nodes
			if (child.nodeName[0] !== "#")
			{
				count++;
			}
		}
		else
		{
			break;
		}
	}
	
	// `:nth-child()` indices don't start at 0
	return count+1;
}
1363551
def processChildElements( element, leafElementsOnly, block )
      if element
         if element.is_a?( Array )
            element.each{ |e| processChildElements( e, leafElementsOnly, block ) }
         elsif element.is_a?( REXML::Element ) and element.has_elements?
            block.call( element ) if not leafElementsOnly
            element.each{ |e|
               if e.is_a?( REXML::Element ) and e.has_elements?
                 processChildElements( e, leafElementsOnly, block )
               else
                 block.call( e )
               end
            }
         end
      end
    end
831865
function parseComments (node, nodeType, feedType) {
  var comments = utils.get(node.comments);

  if (!comments && feedType === 'atom') {
    utils.parse(node.link, function (link) {
      var linkAttr = link['@'];

      if (linkAttr && linkAttr.rel === 'replies' && linkAttr.href) {
        comments = linkAttr.href;
        //if comments are text/html then break out of loop
        if (linkAttr.type === 'text/html') {
          return true;
        }
      }
    }, this, true);
  }

  return comments;
}
173787
function(elems)
	{
	    // Known block elements for handling linefeeds (list is not complete)
		var blocks = ['BLOCKQUOTE', 'DIV', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'OL', 'P', 'PRE', 'TABLE', 'UL'];
		var ret = [];
		
		function doExtract(elts)
		{
			// Single break should be ignored
			if (elts.length == 1 && (elts[0].nodeName == 'BR' ||
				elts[0].innerHTML == '\n'))
			{
				return;
			}
			
		    for (var i = 0; i < elts.length; i++)
		    {
		        var elem = elts[i];

				// DIV with a br or linefeed forces a linefeed
				if (elem.nodeName == 'BR' || elem.innerHTML == '\n' ||
					((elts.length == 1 || i == 0) && (elem.nodeName == 'DIV' &&
					elem.innerHTML.toLowerCase() == '<br>')))
		    	{
	    			ret.push('\n');
		    	}
				else
				{
			        if (elem.nodeType === 3 || elem.nodeType === 4)
			        {
			        	if (elem.nodeValue.length > 0)
			        	{
			        		ret.push(elem.nodeValue);
			        	}
			        }
			        else if (elem.nodeType !== 8 && elem.childNodes.length > 0)
					{
						doExtract(elem.childNodes);
					}
			        
	        		if (i < elts.length - 1 && mxUtils.indexOf(blocks, elts[i + 1].nodeName) >= 0)
	        		{
	        			ret.push('\n');		
	        		}
				}
		    }
		};
		
		doExtract(elems);
	    
	    return ret.join('');
	}
256115
def get_nodes(self, node_id=None, **kwargs):
        
        return self.get_elements(Node, elem_id=node_id, **kwargs)
1239018
static function processNodeTransformationChildren( $useComments, $php, $tpl, &$node, &$children, &$resourceData )
    {
        if ( $children )
        {
            $newChildren = array();
            foreach ( $children as $childNode )
            {
                $newChildNode = eZTemplateCompiler::processNodeTransformationChild( $useComments, $php, $tpl, $childNode, $resourceData );
                if ( !$newChildNode )
                    $newChildren[] = $childNode;
                else
                    $newChildren = array_merge( $newChildren, $newChildNode );
            }
            if ( count( $newChildren ) > 0 )
                return $newChildren;
        }
        return $children;
    }
1273043
def stringify_comment_array comments
      ctxt = ''
      num = nil
      started = false
      last_line = nil
      comments.each { |l|
        # Trim the comment and minimum leading whitespace
        p = l.text.gsub(/^#+/, '')
        if num.nil? and !p.strip.empty?
          num = p.index(/[^ ]/)
          started = true
        elsif started and !p.strip.empty?
          cur = p.index(/[^ ]/)
          num = cur if cur < num
        end
        # Include blank lines between comments
        ctxt += ("\n" * (l.loc.first_line - last_line - 1)) unless last_line.nil? || l.loc.first_line - last_line <= 0
        ctxt += "#{p[num..-1]}\n" if started
        last_line = l.loc.last_line if last_line.nil? || l.loc.last_line > last_line
      }
      ctxt
    end
306410
def _iter_texts(self, tree):
        """"""
        skip = (
            not isinstance(tree, lxml.html.HtmlElement)  # comments, etc.
            or tree.tag in self.skipped_tags
        )
        if not skip:
            if tree.text:
                yield Text(tree.text, tree, 'text')
            for child in tree:
                for text in self._iter_texts(child):
                    yield text
        if tree.tail:
            yield Text(tree.tail, tree, 'tail')
822735
static String getChildElementText(Element parent, String name) {
        // Get children
        List list = DomUtils.getChildElementsByName(parent, name);

        if (list.size() == 1) {
            Element child = (Element) list.get(0);

            StringBuffer buf = new StringBuffer();

            NodeList children = child.getChildNodes();
            for (int i = 0; i < children.getLength(); i++) {
                Node node = children.item(i);
                if (node.getNodeType() == Node.TEXT_NODE ||
                        node.getNodeType() == Node.CDATA_SECTION_NODE) {
                    Text text = (Text) node;
                    buf.append(text.getData().trim());
                }
            }

            return buf.toString();
        } else {
            return null;
        }
    }
164650
@Override
	public String[] getChildNodesValuesText() throws WidgetException {
		WebElement we = new Element(getByLocator()).getWebElement();
		List<WebElement> childNodes = we.findElements(By.xpath("./*"));
		String[] childText = new String[childNodes.size()];
		int i = 0;
		for (WebElement element : childNodes) {
			childText[i] = element.getText();
			i++;
		}
		return childText;
	}
110865
function parse_children(lines, parent_node_names)
{
	// preprocess the lines (filter out comments, blank lines, etc)
	lines = filter_lines_for_parsing(lines)

	// return empty object if there are no lines to parse
	if (lines.length === 0)
	{
		return {}
	}

	// parse each child node's lines
	return split_lines_by_child_nodes(lines).map(function(lines)
	{
		// the first line is this child node's name (or names)
		const declaration_line = lines.shift()

		// check for excessive indentation of the first child style class
		if (declaration_line.tabs !== 0)
		{
			throw new Error(`Excessive indentation (${declaration_line.tabs} more "tabs" than needed) at line ${declaration_line.index}: "${declaration_line.original_line}"`)
		}

		// style class name declaration
		const declaration = declaration_line.line

		// child nodes' names
		const names = declaration.split(',').map(name => name.trim())

		// style class nesting validation
		validate_child_style_class_types(parent_node_names, names)

		// parse own CSS styles and recursively parse all child nodes
		const style_json = parse_style_class(lines, names)

		// generate style json for this child node (or child nodes)
		return names.map(function(node_declaration)
		{
			// parse this child node name
			const { name, is_a_modifier } = parse_node_name(node_declaration)

			// clone the style JSON object for this child node
			const json = extend({}, style_json)

			// set the modifier flag if it's the case
			if (is_a_modifier)
			{
				json._is_a_modifier = true
			}

			// this child node's style JSON object
			return { name, json }
		})
	})
	// convert an array of arrays to a flat array
	.reduce(function(array, child_array)
	{
		return array.concat(child_array);
	}, 
	[])
	// combine all the child nodes into a single JSON object
	.reduce(function(nodes, node)
	{
		// if style already exists for this child node, extend it
		if (nodes[node.name])
		{
			extend(nodes[node.name], node.json)
		}
		else
		{
			nodes[node.name] = node.json
		}
		
		return nodes
	}, 
	{})
}
965789
def list(self, node, elem, module, path):
        """"""
        nel, newm, path = self.sample_element(node, elem, module, path)
        if path is None:
            return
        for kn in node.i_key:
            self.node_handler.get(kn.keyword, self.ignore)(
                kn, nel, newm, path)
        self.process_children(node, nel, newm, path, node.i_key)
        minel = node.search_one("min-elements")
        self.add_copies(node, elem, nel, minel)
        if self.annots:
            self.list_comment(node, nel, minel)
246149
function skipIndex() {
		if( childType && childType.indexOf('[]') === childType.length-2 ) {
			childType = childType.substring(0, childType.length-2);
		}
	}
1090263
function parseMarkup(children) {
    const nodeList = children;
    const cstList = [];

    if (typeof nodeList.length === 'undefined') {
      throw new TypeError('Invalid Argument');
    }

    for (let i = 0, li = nodeList.length; i < li; i++) {
      if (nodeList[i] instanceof HTMLElement && nodeList[i].tagName.toUpperCase() === 'OPTGROUP') {
        const cstOptgroup = document.createElement('div');
        cstOptgroup.classList.add(builderParams.optgroupClass);
        cstOptgroup.setAttribute('data-label', nodeList[i].label);

        // IMPORTANT: Stores in a property of the created custom option group
        // a hook to the the corrisponding select's option group
        cstOptgroup.customSelectOriginalOptgroup = nodeList[i];

        // IMPORTANT: Stores in a property of select's option group
        // a hook to the created custom option group
        nodeList[i].customSelectCstOptgroup = cstOptgroup;

        const subNodes = parseMarkup(nodeList[i].children);
        for (let j = 0, lj = subNodes.length; j < lj; j++) {
          cstOptgroup.appendChild(subNodes[j]);
        }

        cstList.push(cstOptgroup);
      } else if (nodeList[i] instanceof HTMLElement
          && nodeList[i].tagName.toUpperCase() === 'OPTION') {
        const cstOption = document.createElement('div');
        cstOption.classList.add(builderParams.optionClass);
        cstOption.textContent = nodeList[i].text;
        cstOption.setAttribute('data-value', nodeList[i].value);
        cstOption.setAttribute('role', 'option');

        // IMPORTANT: Stores in a property of the created custom option
        // a hook to the the corrisponding select's option
        cstOption.customSelectOriginalOption = nodeList[i];

        // IMPORTANT: Stores in a property of select's option
        // a hook to the created custom option
        nodeList[i].customSelectCstOption = cstOption;

        // If the select's option is selected
        if (nodeList[i].selected) {
          setSelectedElement(cstOption);
        }
        cstList.push(cstOption);
      } else {
        throw new TypeError('Invalid Argument');
      }
    }
    return cstList;
  }