flare.html5.core

HTML5 Widget abstraction library.

  • Provides a Widget-abstraction for each HTML-element

  • Routing of attribute getter/setter and Jquery-style helpers

  • Fully-integrated HTML-parser for quick Widget prototyping

Module Contents

Classes

TextNode

Represents a piece of text inside the DOM.

_WidgetClassWrapper

Built-in mutable sequence.

_WidgetDataWrapper

dict() -> new empty dictionary

_WidgetStyleWrapper

dict() -> new empty dictionary

Widget

_attrLabel

_attrCharset

_attrCite

_attrDatetime

_attrForm

_attrAlt

_attrAutofocus

_attrDisabled

_attrChecked

_attrIndeterminate

_attrName

_attrValue

_attrAutocomplete

_attrRequired

_attrMultiple

_attrSize

_attrFor

_attrInputs

_attrFormhead

_attrHref

_attrTarget

_attrType

_attrMedia

_attrDimensions

_attrUsemap

_attrMultimedia

_attrRel

_attrSrc

A

Area

Audio

Bdo

Blockquote

BodyCls

Canvas

Command

_Del

Dialog

Abbr

Address

Article

Aside

B

Bdi

Br

Caption

Cite

Code

Datalist

Dfn

Div

Em

Embed

Figcaption

Figure

Footer

Header

H1

H2

H3

H4

H5

H6

Hr

I

Kdb

Legend

Mark

Noscript

P

Rq

Rt

Ruby

S

Samp

Section

Small

Strong

Sub

Summery

Sup

U

Var

Wbr

Button

Fieldset

Form

Input

Label

Optgroup

Option

Output

Select

Textarea

HeadCls

Iframe

Img

Ins

Keygen

Link

Ul

Ol

Li

Dl

Dt

Dd

Map

Menu

Meta

Meter

Nav

Object

Param

Progress

Q

Script

Source

Span

Details

Summary

Style

Tr

Td

Th

Thead

Tbody

ColWrapper

RowWrapper

Table

Time

Track

Video

Template

HtmlAst

Abstract syntax tree element used by parseHTML().

Functions

domCreateAttribute(tag[, ns])

Creates a new HTML/SVG/... attribute.

domCreateElement(tag[, ns])

Creates a new HTML/SVG/... tag.

domCreateTextNode([txt])

domGetElementById(idTag)

domElementFromPoint(x, y)

domGetElementsByTagName(tag)

domParseString(string[, mimetype])

Parses the given string with the optionally given mimetype using JavaScript's DOM parser.

domConvertEncodedText(txt)

Convert HTML-encoded text (containing HTML entities) into its decoded string representation.

Body()

Head()

unescape(val[, maxLength])

Unquotes several HTML-quoted characters in a string.

doesEventHitWidgetOrParents(event, widget)

Test if event 'event' hits widget 'widget' (or any of its parents).

doesEventHitWidgetOrChildren(event, widget)

Test if event 'event' hits widget 'widget' (or any of its children).

textToHtml(node, text)

Generates html nodes from text by splitting text into content and into line breaks html5.Br.

parseInt(s[, ret])

Parses a value as int.

parseFloat(s[, ret])

Parses a value as float.

getKey(event)

Returns the Key Identifier of the given event.

isArrowLeft(event)

isArrowUp(event)

isArrowRight(event)

isArrowDown(event)

isEscape(event)

isReturn(event)

isControl(event)

isShift(event)

isMeta(event)

registerTag(tagName, widgetClass[, override])

tag(arg)

Decorator to register a sub-class of html5.Widget either under its class-name or an associated tag-name.

_buildTags([debug])

Generates a dictionary of all to the html5-library known tags and their associated objects and attributes.

parseHTML(→ HtmlAst)

Parses the provided HTML-code according to the tags registered by html5.registerTag() or components that used the html5.tag-decorator.

fromHTML(→ [Widget])

Parses the provided HTML code according to the objects defined in the html5-library.

Attributes

htmlExpressionEvaluator

document

__domParser

_body

_head

__tags

__reVarReplacer

flare.html5.core.htmlExpressionEvaluator
flare.html5.core.document
flare.html5.core.domCreateAttribute(tag, ns=None)

Creates a new HTML/SVG/… attribute.

Parameters:

ns – the namespace. Default: HTML. Possible values: HTML, SVG, XBL, XUL

flare.html5.core.domCreateElement(tag, ns=None)

Creates a new HTML/SVG/… tag.

Parameters:

ns – the namespace. Default: HTML. Possible values: HTML, SVG, XBL, XUL

flare.html5.core.domCreateTextNode(txt='')
flare.html5.core.domGetElementById(idTag)
flare.html5.core.domElementFromPoint(x, y)
flare.html5.core.domGetElementsByTagName(tag)
flare.html5.core.__domParser
flare.html5.core.domParseString(string, mimetype='text/html')

Parses the given string with the optionally given mimetype using JavaScript’s DOM parser. :param string: Any XML/HTML string processable by DOMParser. :param mimetype: The mimetype to use.

Returns:

Returns the parsed document DOM.

flare.html5.core.domConvertEncodedText(txt)

Convert HTML-encoded text (containing HTML entities) into its decoded string representation.

The reason for this function is the handling of HTML entities, which is not properly supported by native JavaScript.

We use the browser’s DOM parser to do this, according to https://stackoverflow.com/questions/3700326/decode-amp-back-to-in-javascript

Parameters:

txt – The encoded text.

Returns:

The decoded text.

class flare.html5.core.TextNode(txt=None, *args, **kwargs)

Bases: object

Represents a piece of text inside the DOM.

This is the only object not deriving from “Widget”, as it does not support any of its properties.

_setText(txt)
_getText()
__str__()

Return str(self).

onAttach()
onDetach()
_setDisabled(disabled)
_getDisabled()
children()
class flare.html5.core._WidgetClassWrapper(targetWidget)

Bases: list

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

set(value)
_updateElem()
append(p_object)

Append object to the end of the list.

clear()

Remove all items from list.

remove(value)

Remove first occurrence of value.

Raises ValueError if the value is not present.

extend(iterable)

Extend list by appending elements from the iterable.

insert(index, p_object)

Insert object before index.

pop(index=None)

Remove and return item at index (default last).

Raises IndexError if list is empty or index is out of range.

class flare.html5.core._WidgetDataWrapper(targetWidget)

Bases: dict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

__setitem__(key, value)

Set self[key] to value.

update(E=None, **F)

D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

class flare.html5.core._WidgetStyleWrapper(targetWidget)

Bases: dict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

__setitem__(key, value)

Set self[key] to value.

update(E=None, **F)

D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

class flare.html5.core.Widget(*args, appendTo=None, style=None, **kwargs)

Bases: object

_namespace
_tagName
_leafTag = False
style = []
sinkEvent(*args)
unsinkEvent(*args)
addEventListener(event, callback)

Adds an event listener callback to an event on a Widget.

Parameters:
  • event – The event string, e.g. “click” or “mouseover”

  • callback – The callback function to be called on the given event. This callback function can either accept no parameters, receive the pure Event-object from JavaScript as one parameter, or receive both the pure Event-object from JavaScript and the Widget-instance where the event was triggered on.

removeEventListener(event, callback)

Removes an event listener callback from a Widget.

The event listener must be previously added by Widget.addEventListener().

Parameters:
  • event – The event string, e.g. “click” or “mouseover”

  • callback – The callback function to be removed

disable()

Disables an element, in case it is not already disabled.

On disabled elements, events are not triggered anymore.

enable()

Enables an element, in case it is not already enabled.

_getTargetfuncName(key, type)
__getitem__(key)
__setitem__(key, value)
__str__()

Return str(self).

__iter__()
_getData()

Custom data attributes are intended to store custom data private to the page or application, for which there are no more appropriate attributes or elements.

Parameters:

name

Returns:

_getTranslate()

Specifies whether an elements attribute values and contents of its children are to be translated when the page is localized, or whether to leave them unchanged.

Returns:

True | False

_setTranslate(val)

Specifies whether an elements attribute values and contents of its children are to be translated when the page is localized, or whether to leave them unchanged.

Parameters:

val – True | False

_getTitle()

Advisory information associated with the element.

Returns:

str

_setTitle(val)

Advisory information associated with the element.

Parameters:

val – str

_getTabindex()

Specifies whether the element represents an element that is is focusable (that is, an element which is part of the sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable elements in the document.

Returns:

number

_setTabindex(val)

Specifies whether the element represents an element that is is focusable (that is, an element which is part of the sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable elements in the document.

Parameters:

val – number

_getSpellcheck()

Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking.

Returns:

True | False

_setSpellcheck(val)

Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking.

Parameters:

val – True | False

_getLang()

Specifies the primary language for the contents of the element and for any of the elements attributes that contain text.

Returns:

language tag e.g. de|en|fr|es|it|ru|

_setLang(val)

Specifies the primary language for the contents of the element and for any of the elements attributes that contain text.

Parameters:

val – language tag

_getHidden()

Specifies that the element represents an element that is not yet, or is no longer, relevant.

Returns:

True | False

_setHidden(val)

Specifies that the element represents an element that is not yet, or is no longer, relevant.

Parameters:

val – True | False

_getDisabled()
_setDisabled(disable)
_getDropzone()

Specifies what types of content can be dropped on the element, and instructs the UA about which actions to take with content when it is dropped on the element.

Returns:

“copy” | “move” | “link”

_setDropzone(val)

Specifies what types of content can be dropped on the element, and instructs the UA about which actions to take with content when it is dropped on the element.

Parameters:

val – “copy” | “move” | “link”

_getDraggable()

Specifies whether the element is draggable.

Returns:

True | False | “auto”

_setDraggable(val)

Specifies whether the element is draggable.

Parameters:

val – True | False | “auto”

_getDir()

Specifies the elements text directionality.

Returns:

ltr | rtl | auto

_setDir(val)

Specifies the elements text directionality.

Parameters:

val – ltr | rtl | auto

_getContextmenu()

The value of the id attribute on the menu with which to associate the element as a context menu.

Returns:

_setContextmenu(val)

The value of the id attribute on the menu with which to associate the element as a context menu.

Parameters:

val

_getContenteditable()

Specifies whether the contents of the element are editable.

Returns:

True | False

_setContenteditable(val)

Specifies whether the contents of the element are editable.

Parameters:

val – True | False

_getAccesskey()

A key label or list of key labels with which to associate the element; each key label represents a keyboard shortcut which UAs can use to activate the element or give focus to the element.

Parameters:

self

Returns:

_setAccesskey(val)

A key label or list of key labels with which to associate the element; each key label represents a keyboard shortcut which UAs can use to activate the element or give focus to the element.

Parameters:
  • self

  • val

_getId()

Specifies a unique id for an element.

Parameters:

self

Returns:

_setId(val)

Specifies a unique id for an element.

Parameters:
  • self

  • val

_getClass()

The class attribute specifies one or more classnames for an element.

Returns:

_setClass(value)

The class attribute specifies one or more classnames for an element.

Parameters:
  • self

  • value

@raise ValueError:

_getStyle()

The style attribute specifies an inline style for an element.

Parameters:

self

Returns:

_getRole()

Specifies a role for an element.

@param self: @return:

_setRole(val)

Specifies a role for an element.

@param self: @param val:

hide()

Hide element, if shown.

Returns:

show()

Show element, if hidden.

Returns:

isHidden()

Checks if a widget is hidden.

Returns:

True if hidden, False otherwise.

isVisible()

Checks if a widget is visible.

Returns:

True if visible, False otherwise.

onBind(widget, name)

Event function that is called on the widget when it is bound to another widget with a name.

This is only done by the HTML parser, a manual binding by the user is not triggered.

onAttach()
onDetach()
__collectChildren(*args, **kwargs)

Internal function for collecting children from args.

This is used by appendChild(), prependChild(), insertChild() etc.

insertBefore(insert, child, **kwargs)
insertAfter(insert, child, **kwargs)
prependChild(*args, **kwargs)
appendChild(*args, **kwargs)
replaceChild(*args, **kwargs)
removeChild(child)
removeAllChildren()

Removes all child widgets of the current widget.

isParentOf(widget)

Checks if an object is the parent of widget.

Parameters:

widget (Widget) – The widget to check for.

Returns:

True, if widget is a child of the object, else False.

isChildOf(widget)

Checks if an object is the child of widget.

Parameters:

widget (Widget) – The widget to check for.

Returns:

True, if object is a child of widget, else False.

hasClass(className)

Determine whether the current widget is assigned the given class.

Parameters:

className (str) – The class name to search for.

addClass(*args)

Adds a class or a list of classes to the current widget.

If the widget already has the class, it is ignored.

Parameters:

args (list of str | list of list of str) – A list of class names. This can also be a list.

removeClass(*args)

Removes a class or a list of classes from the current widget.

Parameters:

args (list of str | list of list of str) – A list of class names. This can also be a list.

toggleClass(on, off=None)

Toggles the class on.

If the widget contains a class on, it is toggled by off. off can either be a class name that is substituted, or nothing.

Parameters:
  • on (str) – Classname to test for. If on does not exist, but off, off is replaced by on.

  • off (str) – Classname to replace if on existed.

Returns:

Returns True, if on was switched, else False.

Return type:

bool

onBlur(event)
onChange(event)
onContextMenu(event)
onFocus(event)
onFocusIn(event)
onFocusOut(event)
onFormChange(event)
onFormInput(event)
onInput(event)
onInvalid(event)
onReset(event)
onSelect(event)
onSubmit(event)
onKeyDown(event)
onKeyPress(event)
onKeyUp(event)
onClick(event, wdg=None)
onDblClick(event)
onDrag(event)
onDragEnd(event)
onDragEnter(event)
onDragLeave(event)
onDragOver(event)
onDragStart(event)
onDrop(event)
onMouseDown(event)
onMouseMove(event)
onMouseOut(event)
onMouseOver(event)
onMouseUp(event)
onMouseWheel(event)
onScroll(event)
onTouchStart(event)
onTouchEnd(event)
onTouchMove(event)
onTouchCancel(event)
focus()
blur()
parent()
children(n=None)

Access children of widget.

If n is ommitted, it returns a list of all child-widgets; Else, it returns the N’th child, or None if its out of bounds.

Parameters:

n (int) – Optional offset of child widget to return.

Returns:

Returns all children or only the requested one.

Return type:

list | Widget | None

sortChildren(key, reversed=False)

Sorts our direct children. They are rearranged on DOM level.

Key must be a function accepting one widget as parameter and must return the key used to sort these widgets.

fromHTML(html, appendTo=None, bindTo=None, replace=False, vars=None, **kwargs)

Parses html and constructs its elements as part of self.

Parameters:
  • html – HTML code.

  • appendTo – The entity where the HTML code is constructed below. This defaults to self in usual case.

  • bindTo – The entity where the named objects are bound to. This defaults to self in usual case.

  • replace – Clear entire content of appendTo before appending.

  • vars – Deprecated; Same as kwargs.

  • **kwargs

    Additional variables provided as a dict for {{placeholders}} inside the HTML

Returns:

class flare.html5.core._attrLabel

Bases: object

_getLabel()
_setLabel(val)
class flare.html5.core._attrCharset

Bases: object

_getCharset()
_setCharset(val)
class flare.html5.core._attrCite

Bases: object

_getCite()
_setCite(val)
class flare.html5.core._attrDatetime

Bases: object

_getDatetime()
_setDatetime(val)
class flare.html5.core._attrForm

Bases: object

_getForm()
_setForm(val)
class flare.html5.core._attrAlt

Bases: object

_getAlt()
_setAlt(val)
class flare.html5.core._attrAutofocus

Bases: object

_getAutofocus()
_setAutofocus(val)
class flare.html5.core._attrDisabled

Bases: object

class flare.html5.core._attrChecked

Bases: object

_getChecked()
_setChecked(val)
class flare.html5.core._attrIndeterminate

Bases: object

_getIndeterminate()
_setIndeterminate(val)
class flare.html5.core._attrName

Bases: object

_getName()
_setName(val)
class flare.html5.core._attrValue

Bases: object

_getValue()
_setValue(val)
class flare.html5.core._attrAutocomplete

Bases: object

_getAutocomplete()
_setAutocomplete(val)
class flare.html5.core._attrRequired

Bases: object

_getRequired()
_setRequired(val)
class flare.html5.core._attrMultiple

Bases: object

_getMultiple()
_setMultiple(val)
class flare.html5.core._attrSize

Bases: object

_getSize()
_setSize(val)
class flare.html5.core._attrFor

Bases: object

_getFor()
_setFor(val)
class flare.html5.core._attrInputs

Bases: _attrRequired

_getMaxlength()
_setMaxlength(val)
_getPlaceholder()
_setPlaceholder(val)
_getReadonly()
_setReadonly(val)
class flare.html5.core._attrFormhead

Bases: object

_getFormaction()
_setFormaction(val)
_getFormenctype()
_setFormenctype(val)
_getFormmethod()
_setFormmethod(val)
_getFormtarget()
_setFormtarget(val)
_getFormnovalidate()
_setFormnovalidate(val)
class flare.html5.core._attrHref

Bases: object

_getHref()

Url of a Page.

Parameters:

self

_setHref(val)

Url of a Page.

Parameters:

val – URL

_getHreflang()
_setHreflang(val)
class flare.html5.core._attrTarget

Bases: object

_getTarget()
_setTarget(val)
class flare.html5.core._attrType

Bases: object

_getType()
_setType(val)
class flare.html5.core._attrMedia

Bases: _attrType

_getMedia()
_setMedia(val)
class flare.html5.core._attrDimensions

Bases: object

_getWidth()
_setWidth(val)
_getHeight()
_setHeight(val)
class flare.html5.core._attrUsemap

Bases: object

_getUsemap()
_setUsemap(val)
class flare.html5.core._attrMultimedia

Bases: object

_getAutoplay()
_setAutoplay(val)
_getPlaysinline()
_setPlaysinline(val)
_getControls()
_setControls(val)
_getLoop()
_setLoop(val)
_getMuted()
_setMuted(val)
_getPreload()
_setPreload(val)
class flare.html5.core._attrRel

Bases: object

_getRel()
_setRel(val)
class flare.html5.core._attrSrc

Bases: object

_getSrc()
_setSrc(val)
class flare.html5.core.A(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrHref, _attrTarget, _attrMedia, _attrRel, _attrName

_tagName = 'a'
_getDownload()

The download attribute specifies the path to a download.

Returns:

filename

_setDownload(val)

The download attribute specifies the path to a download.

Parameters:

val – filename

class flare.html5.core.Area(*args, appendTo=None, style=None, **kwargs)

Bases: A, _attrAlt

_tagName = 'area'
_leafTag = True
_getCoords()
_setCoords(val)
_getShape()
_setShape(val)
class flare.html5.core.Audio(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrSrc, _attrMultimedia

_tagName = 'audio'
class flare.html5.core.Bdo(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'bdo'
class flare.html5.core.Blockquote(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'blockquote'
_getBlockquote()
_setBlockquote(val)
class flare.html5.core.BodyCls(*args, **kwargs)

Bases: Widget

flare.html5.core._body
flare.html5.core.Body()
class flare.html5.core.Canvas(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDimensions

_tagName = 'canvas'
class flare.html5.core.Command(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrLabel, _attrType, _attrDisabled, _attrChecked

_tagName = 'command'
_getIcon()
_setIcon(val)
_getRadiogroup()
_setRadiogroup(val)
class flare.html5.core._Del(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrCite, _attrDatetime

_tagName = '_del'
class flare.html5.core.Dialog(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'dialog'
_getOpen()
_setOpen(val)
class flare.html5.core.Abbr(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'abbr'
class flare.html5.core.Address(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'address'
class flare.html5.core.Article(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'article'
class flare.html5.core.Aside(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'aside'
class flare.html5.core.B(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'b'
class flare.html5.core.Bdi(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'bdi'
class flare.html5.core.Br(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'br'
_leafTag = True
class flare.html5.core.Caption(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'caption'
class flare.html5.core.Cite(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'cite'
class flare.html5.core.Code(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'code'
class flare.html5.core.Datalist(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'datalist'
class flare.html5.core.Dfn(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'dfn'
class flare.html5.core.Div(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'div'
class flare.html5.core.Em(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'em'
class flare.html5.core.Embed(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrSrc, _attrType, _attrDimensions

_tagName = 'embed'
_leafTag = True
class flare.html5.core.Figcaption(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'figcaption'
class flare.html5.core.Figure(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'figure'
class flare.html5.core.Footer(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'footer'
class flare.html5.core.Header(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'header'
class flare.html5.core.H1(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'h1'
class flare.html5.core.H2(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'h2'
class flare.html5.core.H3(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'h3'
class flare.html5.core.H4(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'h4'
class flare.html5.core.H5(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'h5'
class flare.html5.core.H6(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'h6'
class flare.html5.core.Hr(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'hr'
_leafTag = True
class flare.html5.core.I(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'i'
class flare.html5.core.Kdb(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'kdb'
class flare.html5.core.Legend(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'legend'
class flare.html5.core.Mark(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'mark'
class flare.html5.core.Noscript(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'noscript'
class flare.html5.core.P(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'p'
class flare.html5.core.Rq(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'rq'
class flare.html5.core.Rt(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'rt'
class flare.html5.core.Ruby(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'ruby'
class flare.html5.core.S(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 's'
class flare.html5.core.Samp(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'samp'
class flare.html5.core.Section(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'section'
class flare.html5.core.Small(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'small'
class flare.html5.core.Strong(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'strong'
class flare.html5.core.Sub(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'sub'
class flare.html5.core.Summery(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'summery'
class flare.html5.core.Sup(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'sup'
class flare.html5.core.U(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'u'
class flare.html5.core.Var(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'var'
class flare.html5.core.Wbr(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'wbr'
class flare.html5.core.Button(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrType, _attrForm, _attrAutofocus, _attrName, _attrValue, _attrFormhead

_tagName = 'button'
class flare.html5.core.Fieldset(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrForm, _attrName

_tagName = 'fieldset'
class flare.html5.core.Form(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrName, _attrTarget, _attrAutocomplete

_tagName = 'form'
_getNovalidate()
_setNovalidate(val)
_getAction()
_setAction(val)
_getMethod()
_setMethod(val)
_getEnctype()
_setEnctype(val)
_getAccept_attrCharset()
_setAccept_attrCharset(val)
class flare.html5.core.Input(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrType, _attrForm, _attrAlt, _attrAutofocus, _attrChecked, _attrIndeterminate, _attrName, _attrDimensions, _attrValue, _attrFormhead, _attrAutocomplete, _attrInputs, _attrMultiple, _attrSize, _attrSrc

_tagName = 'input'
_leafTag = True
_getAccept()
_setAccept(val)
_getList()
_setList(val)
_getMax()
_setMax(val)
_getMin()
_setMin(val)
_getPattern()
_setPattern(val)
_getStep()
_setStep(val)
class flare.html5.core.Label(*args, forElem=None, **kwargs)

Bases: Widget, _attrForm, _attrFor

_tagName = 'label'
autoIdCounter = 0
class flare.html5.core.Optgroup(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrLabel

_tagName = 'optgroup'
class flare.html5.core.Option(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrLabel, _attrValue

_tagName = 'option'
_getSelected()
_setSelected(val)
class flare.html5.core.Output(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrForm, _attrName, _attrFor

_tagName = 'output'
class flare.html5.core.Select(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrForm, _attrAutofocus, _attrName, _attrRequired, _attrMultiple, _attrSize

_tagName = 'select'
_getSelectedIndex()
_getOptions()
class flare.html5.core.Textarea(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrForm, _attrAutofocus, _attrName, _attrInputs, _attrValue

_tagName = 'textarea'
_getCols()
_setCols(val)
_getRows()
_setRows(val)
_getWrap()
_setWrap(val)
class flare.html5.core.HeadCls(*args, **kwargs)

Bases: Widget

flare.html5.core._head
flare.html5.core.Head()
class flare.html5.core.Iframe(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrSrc, _attrName, _attrDimensions

_tagName = 'iframe'
_getSandbox()
_setSandbox(val)
_getSrcdoc()
_setSrcdoc(val)
_getSeamless()
_setSeamless(val)
class flare.html5.core.Img(src=None, *args, **kwargs)

Bases: Widget, _attrSrc, _attrDimensions, _attrUsemap, _attrAlt

_tagName = 'img'
_leafTag = True
_getCrossorigin()
_setCrossorigin(val)
_getIsmap()
_setIsmap(val)
class flare.html5.core.Ins(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrCite, _attrDatetime

_tagName = 'ins'
class flare.html5.core.Keygen(*args, appendTo=None, style=None, **kwargs)

Bases: Form, _attrAutofocus, _attrDisabled

_tagName = 'keygen'
_getChallenge()
_setChallenge(val)
_getKeytype()
_setKeytype(val)

Bases: Widget, _attrHref, _attrMedia, _attrRel

_tagName = 'link'
_leafTag = True
_getSizes()
_setSizes(val)
class flare.html5.core.Ul(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'ul'
class flare.html5.core.Ol(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'ol'
class flare.html5.core.Li(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'li'
class flare.html5.core.Dl(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'dl'
class flare.html5.core.Dt(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'dt'
class flare.html5.core.Dd(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'dd'
class flare.html5.core.Map(*args, forElem=None, **kwargs)

Bases: Label, _attrType

_tagName = 'map'
class flare.html5.core.Menu(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'menu'
class flare.html5.core.Meta(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrName, _attrCharset

_tagName = 'meta'
_leafTag = True
_getContent()
_setContent(val)
class flare.html5.core.Meter(*args, appendTo=None, style=None, **kwargs)

Bases: Form, _attrValue

_tagName = 'meter'
_getHigh()
_setHigh(val)
_getLow()
_setLow(val)
_getMax()
_setMax(val)
_getMin()
_setMin(val)
_getOptimum()
_setOptimum(val)
class flare.html5.core.Nav(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'nav'
class flare.html5.core.Object(*args, appendTo=None, style=None, **kwargs)

Bases: Form, _attrType, _attrName, _attrDimensions, _attrUsemap

_tagName = 'object'
class flare.html5.core.Param(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrName, _attrValue

_tagName = 'param'
_leafTag = True
class flare.html5.core.Progress(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrValue

_tagName = 'progress'
_getMax()
_setMax(val)
class flare.html5.core.Q(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrCite

_tagName = 'q'
class flare.html5.core.Script(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrSrc, _attrCharset

_tagName = 'script'
_getAsync()
_setAsync(val)
_getDefer()
_setDefer(val)
class flare.html5.core.Source(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrMedia, _attrSrc

_tagName = 'source'
_leafTag = True
class flare.html5.core.Span(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'span'
class flare.html5.core.Details(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'details'
_getOpen()
_setOpen(val)
class flare.html5.core.Summary(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'summary'
class flare.html5.core.Style(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrMedia

_tagName = 'style'
_getScoped()
_setScoped(val)
class flare.html5.core.Tr(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'tr'
_getRowspan()
_setRowspan(span)
class flare.html5.core.Td(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'td'
_getColspan()
_setColspan(span)
_getRowspan()
_setRowspan(span)
class flare.html5.core.Th(*args, appendTo=None, style=None, **kwargs)

Bases: Td

_tagName = 'th'
class flare.html5.core.Thead(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'thead'
class flare.html5.core.Tbody(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'tbody'
class flare.html5.core.ColWrapper(parentElem, *args, **kwargs)

Bases: object

__getitem__(item)
__setitem__(key, value)
class flare.html5.core.RowWrapper(parentElem, *args, **kwargs)

Bases: object

__getitem__(item)
class flare.html5.core.Table(*args, **kwargs)

Bases: Widget

_tagName = 'table'
prepareRow(row)
prepareCol(row, col)
prepareGrid(rows, cols)
clear()
_getCell()
getRowCount()
class flare.html5.core.Time(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDatetime

_tagName = 'time'
class flare.html5.core.Track(*args, forElem=None, **kwargs)

Bases: Label, _attrSrc

_tagName = 'track'
_leafTag = True
_getKind()
_setKind(val)
_getSrclang()
_setSrclang(val)
_getDefault()
_setDefault(val)
class flare.html5.core.Video(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrSrc, _attrDimensions, _attrMultimedia

_tagName = 'video'
_getPoster()
_setPoster(val)
class flare.html5.core.Template(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = 'template'
flare.html5.core.unescape(val, maxLength=0)

Unquotes several HTML-quoted characters in a string.

Parameters:
  • val (str) – The value to be unescaped.

  • maxLength (int) – Cut-off after maxLength characters. A value of 0 means “unlimited”. (default)

Returns:

The unquoted string.

Return type:

str

flare.html5.core.doesEventHitWidgetOrParents(event, widget)

Test if event ‘event’ hits widget ‘widget’ (or any of its parents).

flare.html5.core.doesEventHitWidgetOrChildren(event, widget)

Test if event ‘event’ hits widget ‘widget’ (or any of its children).

flare.html5.core.textToHtml(node, text)

Generates html nodes from text by splitting text into content and into line breaks html5.Br.

Parameters:
  • node – The node where the nodes are appended to.

  • text – The text to be inserted.

flare.html5.core.parseInt(s, ret=0)

Parses a value as int.

flare.html5.core.parseFloat(s, ret=0.0)

Parses a value as float.

flare.html5.core.getKey(event)

Returns the Key Identifier of the given event.

Available Codes: https://www.w3.org/TR/2006/WD-DOM-Level-3-Events-20060413/keyset.html#KeySet-Set

flare.html5.core.isArrowLeft(event)
flare.html5.core.isArrowUp(event)
flare.html5.core.isArrowRight(event)
flare.html5.core.isArrowDown(event)
flare.html5.core.isEscape(event)
flare.html5.core.isReturn(event)
flare.html5.core.isControl(event)
flare.html5.core.isShift(event)
flare.html5.core.isMeta(event)
flare.html5.core.__tags
flare.html5.core.__reVarReplacer
flare.html5.core.registerTag(tagName, widgetClass, override=True)
flare.html5.core.tag(arg)

Decorator to register a sub-class of html5.Widget either under its class-name or an associated tag-name.

Examples

```python # register class Foo as <foo>-Tag @html5.tag class Foo(html5.Div):

pass

# register class Bar as <baz>-Tag @html5.tag(“baz”) class Bar(html5.Div):

pass

```

flare.html5.core._buildTags(debug=False)

Generates a dictionary of all to the html5-library known tags and their associated objects and attributes.

class flare.html5.core.HtmlAst

Bases: list

Abstract syntax tree element used by parseHTML().

flare.html5.core.parseHTML(html: str, debug: bool = False) HtmlAst

Parses the provided HTML-code according to the tags registered by html5.registerTag() or components that used the html5.tag-decorator.

flare.html5.core.fromHTML(html: [str, HtmlAst], appendTo: Widget = None, bindTo: Widget = None, debug: bool = False, **kwargs) [Widget]

Parses the provided HTML code according to the objects defined in the html5-library.

html can also be pre-compiled by parseHTML() so that it executes faster.

Constructs all objects as DOM nodes. The first level is chained into appendTo. If no appendTo is provided, appendTo will be set to html5.Body().

If bindTo is provided, objects are bound to this widget.

```python from vi import html5

div = html5.Div() html5.parse.fromHTML(‘’’

<div>Yeah!

<a href=”hello world” [name]=”myLink” class=”trullman bernd” disabled> hah ala malla” bababtschga” <img src=”/static/images/icon_home.svg” style=”background-color: red;”/>st <em>ah</em>ralla <i>malla tralla</i> da </a>lala

</div>’’’, div)

div.myLink.appendChild(“appended!”) ```