def item(self, index): from thug.DOM.W3C.DOMImplementation import DOMImplementation node = self.nodes[index] return DOMImplementation.createHTMLElement(self.doc, node) if node else None
def namedItem(self, name): from thug.DOM.W3C.DOMImplementation import DOMImplementation for node in self.nodes: if node.nodeName == name: return DOMImplementation.createHTMLElement(self.doc, node) if node else None return None
def styleSheets(self): from .HTMLCollection import HTMLCollection from thug.DOM.W3C.DOMImplementation import DOMImplementation return HTMLCollection(self.doc, [ DOMImplementation.createHTMLElement(self.doc, f) for f in self.doc.find_all('style') ])
def namedItem(self, name): from thug.DOM.W3C.DOMImplementation import DOMImplementation for node in self.nodes: if node.nodeName == name: return DOMImplementation.createHTMLElement(self.doc, node) if node else None return None
def getter(self): children = getChildren(self.doc, parts) if xpath == '/html/body[1]' and not children: children = [self.doc] if parts[-1] == 'text()': return "".join(children) m = RE_INDEXED.match(parts[-1]) if m: try: from thug.DOM.W3C.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)
def getter(self): children = getChildren(self.doc, parts) if xpath == '/html/body[1]' and not children: children = [self.doc] if parts[-1] == 'text()': return "".join(children) m = RE_INDEXED.match(parts[-1]) if m: try: from thug.DOM.W3C.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)
def item(self, index): from thug.DOM.W3C.DOMImplementation import DOMImplementation return DOMImplementation.createHTMLElement( self.doc, self.nodes[index]) if 0 <= index and index < len( self.nodes) else None
def item(self, index): from thug.DOM.W3C.DOMImplementation import DOMImplementation node = self.nodes[index] return DOMImplementation.createHTMLElement(self.doc, node) if node else None
def item(self, index): from thug.DOM.W3C.DOMImplementation import DOMImplementation return DOMImplementation.createHTMLElement(self.doc, self.nodes[index]) if 0 <= index and index < len(self.nodes) else None
def forms(self): from thug.DOM.W3C.DOMImplementation import DOMImplementation return HTMLCollection(self.doc, [ DOMImplementation.createHTMLElement(self.doc, f) for f in self.doc.find_all('form') ])