How to use the thug.DOM.W3C.HTML.HTMLCollection.HTMLCollection function in thug

To help you get started, we’ve selected a few thug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github buffer / thug / thug / DOM / W3C / HTML / HTMLDocument.py View on Github external
def getElementsByName(self, elementName):
        from .HTMLCollection import HTMLCollection

        tags = self.doc.find_all(attrs = {'name': elementName})
        return HTMLCollection(self.doc, tags)
github buffer / thug / thug / DOM / W3C / HTML / HTMLOptionsCollection.py View on Github external
def __init__(self, doc, nodes):
        HTMLCollection.__init__(self, doc, nodes)
github buffer / thug / thug / DOM / W3C / HTML / HTMLDocument.py View on Github external
def forms(self):
        from .HTMLCollection import HTMLCollection

        nodes = [f for f in self.doc.find_all('form')]
        return HTMLCollection(self.doc, nodes)
github buffer / thug / thug / DOM / W3C / HTML / HTMLTableSectionElement.py View on Github external
def __init__(self, doc, tag):
        HTMLElement.__init__(self, doc, tag)
        self._rows = HTMLCollection(doc, list())
github buffer / thug / thug / DOM / W3C / HTML / HTMLDocument.py View on Github external
def anchors(self):
        from .HTMLCollection import HTMLCollection

        nodes = [f for f in self.doc.find_all('a') if 'name' in f.attrs and f.attrs['name']]
        return HTMLCollection(self.doc, nodes)
github buffer / thug / thug / DOM / W3C / HTML / HTMLDocument.py View on Github external
def applets(self):
        from .HTMLCollection import HTMLCollection

        applets = [f for f in self.doc.find_all('applet')]
        objects = [f for f in self.doc.find_all('object') if 'type' in f.attrs and 'applet' in f.attrs['type']]
        return HTMLCollection(self.doc, applets + objects)
github buffer / thug / thug / DOM / W3C / HTML / HTMLTableElement.py View on Github external
def __init__(self, doc, tag):
        HTMLElement.__init__(self, doc, tag)
        self._caption = None
        self._tHead   = None
        self._tFoot   = None
        self._rows    = HTMLCollection(doc, list())
        self._tBodies = HTMLCollection(doc, list())
github buffer / thug / thug / DOM / W3C / HTML / xpath_property.py View on Github external
if parts[-1] == 'text()':
            return "".join(children)

        m = RE_INDEXED.match(parts[-1])

        if m:
            try:
                from thug.DOM.W3C.Core.DOMImplementation import DOMImplementation
                string.atoi(m.group(2))

                return DOMImplementation.createHTMLElement(self.doc, children[0]) if len(children) > 0 else None
            except ValueError:
                pass

        return HTMLCollection(self.doc, children)
github buffer / thug / thug / DOM / W3C / HTML / HTMLOptionsCollection.py View on Github external
#!/usr/bin/env python

from .HTMLCollection import HTMLCollection


# Introduced in DOM Level 2
class HTMLOptionsCollection(HTMLCollection):
    def __init__(self, doc, nodes):
        HTMLCollection.__init__(self, doc, nodes)
github buffer / thug / thug / DOM / Window.py View on Github external
def frames(self):
        """an array of all the frames (including iframes) in the current window"""
        from thug.DOM.W3C.HTML.HTMLCollection import HTMLCollection

        frames = set()
        for frame in self._findAll(['frame', 'iframe']):
            if not getattr(frame, '_node', None):
                from thug.DOM.W3C.Core.DOMImplementation import DOMImplementation
                DOMImplementation.createHTMLElement(self.window.doc, frame)

            frames.add(frame._node)

        return HTMLCollection(self.doc, list(frames))