How to use the thug.DOM.W3C.HTML.attr_property.attr_property 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 / HTMLInputElement.py View on Github external
accessKey      = attr_property("accesskey")
    align          = attr_property("align")
    alt            = attr_property("alt")
    checked        = bool_property("checked")
    defaultChecked = bool_property("checked")
    defaultValue   = bool_property("value")
    disabled       = bool_property("disabled")
    form           = form_property()
    maxLength      = attr_property("maxlength", int, default = six.MAXSIZE)
    name           = attr_property("name")
    readOnly       = bool_property("readonly")
    size           = attr_property("size", int)
    src            = attr_property("src")
    tabIndex       = attr_property("tabindex", int)
    type           = attr_property("type", default = "text")
    useMap         = attr_property("usermap")
    _value         = attr_property("value")

    def __init__(self, doc, tag):
        HTMLElement.__init__(self, doc, tag)

    def getValue(self):
        return self._value

    def setValue(self, value):
        self._value = value

    value = property(getValue, setValue)

    def blur(self):
        pass
github buffer / thug / thug / DOM / W3C / HTML / HTMLMetaElement.py View on Github external
#!/usr/bin/env python

import logging

from .HTMLElement import HTMLElement
from .attr_property import attr_property

log = logging.getLogger("Thug")


class HTMLMetaElement(HTMLElement):
    content   = attr_property("content")
    httpEquiv = attr_property("http-equiv")
    name      = attr_property("name", default = "")
    scheme    = attr_property("scheme")
    _charset  = attr_property("charset", default = "")

    def __init__(self, doc, tag):
        HTMLElement.__init__(self, doc, tag)

    def __getattr__(self, name):
        if name in ('charset', ) and log.ThugOpts.Personality.isIE():
            return self._charset

        raise AttributeError
github buffer / thug / thug / DOM / W3C / HTML / HTMLTableElement.py View on Github external
from .HTMLElement import HTMLElement
from .HTMLCollection import HTMLCollection
from .HTMLTableRowElement import HTMLTableRowElement
from .HTMLTableSectionElement import HTMLTableSectionElement
from .HTMLTableCaptionElement import HTMLTableCaptionElement
from .attr_property import attr_property

log = logging.getLogger("Thug")


class HTMLTableElement(HTMLElement):
    align       = attr_property("align")
    bgColor     = attr_property("bgcolor")
    border      = attr_property("border")
    cellPadding = attr_property("cellpadding")
    cellSpacing = attr_property("cellspacing")
    frame       = attr_property("frame")
    rules       = attr_property("rules")
    summary     = attr_property("summary")
    width       = attr_property("width")

    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())

    @property
    def caption(self):
github buffer / thug / thug / DOM / W3C / HTML / HTMLScriptElement.py View on Github external
from .HTMLElement import HTMLElement
from .attr_property import attr_property
from .bool_property import bool_property
from .text_property import text_property

log = logging.getLogger("Thug")


class HTMLScriptElement(HTMLElement):
    _async  = bool_property("async", readonly = True, novalue = True)
    text    = text_property()
    htmlFor = None
    event   = None
    charset = attr_property("charset", default = "")
    defer   = bool_property("defer", readonly = True, novalue = True)
    _src    = attr_property("src", default = "")
    type    = attr_property("type")

    def __init__(self, doc, tag):
        HTMLElement.__init__(self, doc, tag)

    def __getattr__(self, name):
        if name in ("async", ):
            return self._async

        raise AttributeError

    def get_src(self):
        return self._src

    def set_src(self, src):
        self._src = src
github buffer / thug / thug / DOM / W3C / HTML / HTMLTableColElement.py View on Github external
#!/usr/bin/env python

from .HTMLElement import HTMLElement
from .attr_property import attr_property


class HTMLTableColElement(HTMLElement):
    align  = attr_property("align")
    ch     = attr_property("char")
    chOff  = attr_property("charoff")
    span   = attr_property("span", int)
    vAlign = attr_property("valign")
    width  = attr_property("width")

    def __init__(self, doc, tag):
        HTMLElement.__init__(self, doc, tag)
github buffer / thug / thug / DOM / W3C / HTML / HTMLOptionElement.py View on Github external
#!/usr/bin/env python

from .HTMLElement import HTMLElement
from .attr_property import attr_property
from .bool_property import bool_property
from .form_property import form_property


class HTMLOptionElement(HTMLElement):
    defaultSelected = bool_property("selected")
    index           = attr_property("index", int, readonly = True)
    disabled        = bool_property("disabled")
    form            = form_property()
    label           = attr_property("label")
    selected        = False
    value           = attr_property("value")

    def __init__(self, doc, tag):
        HTMLElement.__init__(self, doc, tag)

    @property
    def text(self):
        return str(self.tag.string) if self.tag.string else ""
github buffer / thug / thug / DOM / W3C / HTML / HTMLTextAreaElement.py View on Github external
#!/usr/bin/env python

from .HTMLElement import HTMLElement
from .attr_property import attr_property
from .bool_property import bool_property
from .text_property import text_property
from .form_property import form_property


class HTMLTextAreaElement(HTMLElement):
    accessKey = attr_property("accesskey")
    cols      = attr_property("cols", int)
    disabled  = bool_property("disabled")
    form      = form_property()
    name      = attr_property("name")
    readOnly  = bool_property("readonly")
    rows      = attr_property("rows", int)
    tabIndex  = attr_property("tabindex", int)
    value     = text_property()

    def __init__(self, doc, tag):
        HTMLElement.__init__(self, doc, tag)

    @property
    def defaultValue(self):
        return self.value

    @property
github buffer / thug / thug / DOM / W3C / HTML / HTMLParagraphElement.py View on Github external
#!/usr/bin/env python

from .HTMLElement import HTMLElement
from .attr_property import attr_property


class HTMLParagraphElement(HTMLElement):
    align = attr_property("align")

    def __init__(self, doc, tag):
        HTMLElement.__init__(self, doc, tag)
github buffer / thug / thug / DOM / W3C / HTML / HTMLFrameElement.py View on Github external
#!/usr/bin/env python

import logging
from .HTMLElement import HTMLElement
from .attr_property import attr_property

log = logging.getLogger("Thug")


class HTMLFrameElement(HTMLElement):
    frameBorder  = attr_property("frameborder")
    longDesc     = attr_property("longdesc")
    marginHeight = attr_property("marginheight")
    marginWidth  = attr_property("marginwidth")
    name         = attr_property("name")
    noResize     = attr_property("noresize", bool)
    scrolling    = attr_property("scrolling")
    src          = attr_property("src")

    def __init__(self, doc, tag):
        HTMLElement.__init__(self, doc, tag)

    # Introduced in DOM Level 2
    @property
    def contentDocument(self):
        return self.doc if self.doc else None

    @property
    def contentWindow(self):
github buffer / thug / thug / DOM / W3C / HTML / HTMLAppletElement.py View on Github external
#!/usr/bin/env python

from .HTMLElement import HTMLElement
from .attr_property import attr_property


class HTMLAppletElement(HTMLElement):
    align    = attr_property("align")
    alt      = attr_property("alt")
    archive  = attr_property("archive")
    code     = attr_property("code")
    codeBase = attr_property("codebase")
    height   = attr_property("height")
    hspace   = attr_property("hspace", int)
    name     = attr_property("name")
    object   = attr_property("object")
    vspace   = attr_property("vspace", int)
    width    = attr_property("width")

    def __init__(self, doc, tag):
        HTMLElement.__init__(self, doc, tag)