How to use the thug.DOM.W3C.Core.Node.Node 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 / Core / Node.py View on Github external
def is_text(self, node):
        return node.nodeType in (Node.TEXT_NODE,
                                 Node.PROCESSING_INSTRUCTION_NODE,
                                 Node.CDATA_SECTION_NODE, )
github buffer / thug / thug / DOM / W3C / Core / Node.py View on Github external
def is_readonly(self, node):
        return node.nodeType in (Node.DOCUMENT_TYPE_NODE,
                                 Node.NOTATION_NODE,
                                 Node.ENTITY_REFERENCE_NODE,
                                 Node.ENTITY_NODE, )
github buffer / thug / thug / DOM / W3C / Core / Node.py View on Github external
for p in self.tag.contents:
                if getattr(p, '_node', None) is None:
                    continue

                if newChildHash == hash(p._node):
                    p.extract()

        if self.is_text(newChild):
            self.tag.append(newChild.data.output_ready(formatter = lambda x: x))
            return newChild

        if newChild.nodeType in (Node.COMMENT_NODE, ):
            self.tag.append(newChild.data)
            return newChild

        if newChild.nodeType in (Node.DOCUMENT_FRAGMENT_NODE, ):
            node = self.tag
            for p in newChild.tag.find_all_next():
                node.append(p)
                node = p

            return newChild

        self.tag.append(newChild.tag)
        return newChild
github buffer / thug / thug / DOM / W3C / Core / Node.py View on Github external
def is_readonly(self, node):
        return node.nodeType in (Node.DOCUMENT_TYPE_NODE,
                                 Node.NOTATION_NODE,
                                 Node.ENTITY_REFERENCE_NODE,
                                 Node.ENTITY_NODE, )
github buffer / thug / thug / DOM / W3C / Core / Node.py View on Github external
def is_readonly(self, node):
        return node.nodeType in (Node.DOCUMENT_TYPE_NODE,
                                 Node.NOTATION_NODE,
                                 Node.ENTITY_REFERENCE_NODE,
                                 Node.ENTITY_NODE, )
github buffer / thug / thug / DOM / W3C / Core / Node.py View on Github external
def is_text(self, node):
        return node.nodeType in (Node.TEXT_NODE,
                                 Node.PROCESSING_INSTRUCTION_NODE,
                                 Node.CDATA_SECTION_NODE, )
github buffer / thug / thug / DOM / W3C / Core / Node.py View on Github external
def nextSibling(self):
        return Node.wrap(self.doc, self.tag.next_sibling)
github buffer / thug / thug / DOM / W3C / Core / Notation.py View on Github external
#!/usr/bin/env python

from .Node import Node


class Notation(Node): # pragma: no cover
    @property
    def publicId(self):
        return None

    @property
    def systemId(self):
        return None

    @property
    def nodeName(self):
        pass

    @property
    def nodeType(self):
        return Node.NOTATION_NODE
github buffer / thug / thug / DOM / W3C / Core / Attr.py View on Github external
def nodeType(self):
        return Node.ATTRIBUTE_NODE
github buffer / thug / thug / DOM / W3C / Core / Node.py View on Github external
def is_readonly(self, node):
        return node.nodeType in (Node.DOCUMENT_TYPE_NODE,
                                 Node.NOTATION_NODE,
                                 Node.ENTITY_REFERENCE_NODE,
                                 Node.ENTITY_NODE, )