Iterate a HTML element.
486168
def iter_links_element(self, element):
        ''''''
        # reference: lxml.html.HtmlMixin.iterlinks()
        attrib = element.attrib
        tag = element.tag

        if tag == 'link':
            iterable = self.iter_links_link_element(element)
        elif tag == 'meta':
            iterable = self.iter_links_meta_element(element)
        elif tag in ('object', 'applet'):
            iterable = self.iter_links_object_element(element)
        elif tag == 'param':
            iterable = self.iter_links_param_element(element)
        elif tag == 'style':
            iterable = self.iter_links_style_element(element)
        elif tag == 'script':
            iterable = self.iter_links_script_element(element)
        else:
            iterable = self.iter_links_plain_element(element)

        # RSS/Atom
        if tag in ('link', 'url', 'icon'):
            iterable = itertools.chain(
                iterable, self.iter_links_element_text(element)
            )

        for link_info in iterable:
            yield link_info

        if 'style' in attrib and self.css_scraper:
            for link in self.css_scraper.scrape_links(attrib['style']):
                yield LinkInfo(
                    element=element, tag=element.tag, attrib='style',
                    link=link,
                    inline=True, linked=False,
                    base_link=None,
                    value_type='css',
                    link_type=LinkType.media,
                )
1368185
def iter_links_plain_element(self, element):
        ''''''
        for attrib_name, link in self.iter_links_by_attrib(element):
            if attrib_name in self.LINK_ATTRIBUTES:
                inline = self.is_link_inline(element.tag, attrib_name)
                linked = self.is_html_link(element.tag, attrib_name)
            else:
                inline = is_likely_inline(link)
                linked = not inline

            link_type = identify_link_type(link)

            yield LinkInfo(
                element=element, tag=element.tag, attrib=attrib_name,
                link=link,
                inline=inline, linked=linked,
                base_link=None,
                value_type='plain',
                link_type=link_type
            )
261015
def find_element_by_jquery(step, browser, selector):
    """"""
    elements = find_elements_by_jquery(browser, selector)
    assert_true(step, len(elements) > 0)
    return elements[0]
518992
def innerHTML(self) -> str:
        """"""
        if self._inner_element:
            return self._inner_element.innerHTML
        return super().innerHTML
700850
def intersperse(iterable, element):
    """"""
    iterable = iter(iterable)
    yield next(iterable)
    while True:
        next_from_iterable = next(iterable)
        yield element
        yield next_from_iterable
1208625
function forEach(iterable, callback) {
    for (var i = 0; i < iterable.length; i++) {
        callback(iterable[i], i);
    }
}
1151985
def start_element(self, tag, attrs):
        """"""
        if tag == u'form':
            if u'action' in attrs:
                url = attrs['action']
                self.form = Form(url)
        elif tag == u'input':
            if self.form:
                if 'name' in attrs:
                    key = attrs['name']
                    value = attrs.get('value')
                    self.form.add_value(key, value)
                else:
                    log.warning(LOG_CHECK, "nameless form input %s" % attrs)
                    pass
            else:
                log.warning(LOG_CHECK, "formless input´%s" % attrs)
                pass
436079
def iter_links_by_js_attrib(self, attrib_name, attrib_value):
        ''''''
        links = self.javascript_scraper.scrape_links(attrib_value)

        for link in links:
            yield attrib_name, link
135613
def _render_iteratable(iteratable, level):
    """"""
    if isinstance(iteratable, basestring):
        return unicode(iteratable)
    return ''.join([render(element, level) for element in iteratable])
229771
def iterate(it):
    """"""
    if is_async_iterable(it):
        return from_async_iterable.raw(it)
    if isinstance(it, Iterable):
        return from_iterable.raw(it)
    raise TypeError(
        f"{type(it).__name__!r} object is not (async) iterable")
74360
def cast_in(self, element):
        """"""
        if _debug: Any._debug("cast_in %r", element)

        t = TagList()
        if isinstance(element, Atomic):
            tag = Tag()
            element.encode(tag)
            t.append(tag)
        elif isinstance(element, AnyAtomic):
            tag = Tag()
            element.value.encode(tag)
            t.append(tag)
        else:
            element.encode(t)

        self.tagList.extend(t.tagList)
1298882
def iter_up(self, include_self=True):
        """"""
        if include_self: yield self
        parent = self.parent
        while parent is not None:
            yield parent
            try:
                parent = parent.parent
            except AttributeError:
                return
517557
public static Iterator<HTMLElement> iterator(HTMLElement parent) {
        return parent != null ? new JsArrayElementIterator(parent) : emptyIterator();
    }
866188
def _load(self, element, commentchar):
        """"""
        for child in element:            
            if "id" in child.attrib:
                tline = TemplateLine(child, self, commentchar)
                self.order.append(tline.identifier)
                self.lines[tline.identifier] = tline
            else:
                msg.warn("no id element in {}. Ignored. (group._load)".format(child))
15877
function each(collection, iterator) {
  for (var i = 0; i < collection.length; i++) {
    iterator(collection[i], i);
  }
}
497350
def getElements(self, node, name, nsuri=None):
        """"""
        nsmatch = self.nsUriMatch
        result = []
        ELEMENT_NODE = node.ELEMENT_NODE
        for child in node.childNodes:
            if child.nodeType == ELEMENT_NODE:
                if ((child.localName == name or name is None) and (
                    (nsuri is None) or nsmatch(child.namespaceURI, nsuri))):
                    result.append(child)
        return result
613466
def iterate(self, iterable, format="%s"):
        

        # If iterable has a definite length, then set the maximum value of the
        # progress bar. Else, set the maximum value to -1 so that the progress
        # bar displays indeterminate progress (scrolling dots).
        try:
            length = len(iterable)
        except TypeError:
            self.max = -1
        else:
            self.max = length

        # Iterate over the input, updating the progress bar for each element.
        for i, item in enumerate(iterable):
            self.update(i, format % item)
            yield item