Node interfaces/classes¶
-
class
wdom.node.Node(parent: wdom.node.AbstractNode = None) → None[source]¶ Bases:
wdom.node.AbstractNodeBase Class for Node interface.
Initialize node object with parent node.
Parameters: parent (Node) – parent node. -
connected¶ When this instance has any connection, return True.
Return type: bool
-
length¶ Return number of child nodes.
Return type: int
-
parentNode¶ Return parent node.
If this node does not have a parent, return
None.Return type: Optional[AbstractNode]
-
childNodes¶ Return child nodes of this node.
Returned object is an instance of NodeList, which is a list like object but not support any modification. NodeList is a live object, which means that changes on this node is reflected to the object.
Return type: NodeList[]
-
firstChild¶ Return the first child node.
If this node does not have any child, return
None.Return type: Optional[AbstractNode]
-
lastChild¶ Return the last child node.
If this node does not have any child, return
None.Return type: Optional[AbstractNode]
-
previousSibling¶ Return the previous sibling of this node.
If there is no previous sibling, return
None.Return type: Optional[AbstractNode]
-
nextSibling¶ Return the next sibling of this node.
If there is no next sibling, return
None.Return type: Optional[AbstractNode]
-
ownerDocument¶ Return the owner document of this node.
Owner document is an ancestor document node of this node. If this node (or node tree including this node) is not appended to any document node, this property returns
None.Return type: Document or None
-
appendChild(node)[source]¶ Append the node at the last of this child nodes.
Return type: AbstractNode
-
index(node)[source]¶ Return index of the node.
If the node is not a child of this node, raise
ValueError.Return type: int
-
insertBefore(node, ref_node)[source]¶ Insert a node just before the reference node.
Return type: AbstractNode
-
hasChildNodes()[source]¶ Return True if this node has child nodes, otherwise return False.
Return type: bool
-
removeChild(node)[source]¶ Remove a node from this node.
If node is not a child of this node, raise
ValueError.Return type: AbstractNode
-
replaceChild(new_child, old_child)[source]¶ Replace an old child with new child.
Return type: AbstractNode
-
cloneNode(deep=False)[source]¶ Return new copy of this node.
If optional argument
deepis specified and is True, new node has clones of child nodes of this node (if presents).Return type: AbstractNode
-
empty()[source]¶ [Not Standard] Remove all child nodes from this node.
This is equivalent to
node.textContent = ''.Return type: None
-
textContent¶ Return text contents of this node and all chid nodes.
When any value is set to this property, all child nodes are removed and new value is set as a text node.
Return type: str
-
-
class
wdom.node.Text(text: str = '', parent: wdom.node.Node = None) → None[source]¶ Bases:
wdom.node.CharacterDataNode class to wrap text contents.
-
html¶ Return html-escaped string representation of this node.
Return type: str
-
-
class
wdom.node.RawHtml(text: str = '', parent: wdom.node.Node = None) → None[source]¶ Bases:
wdom.node.TextVery similar to
Textclass, but contents are always not escaped.This node is [NOT DOM Standard].
-
html¶ Return html representation.
Return type: str
-
-
class
wdom.node.Comment(text: str = '', parent: wdom.node.Node = None) → None[source]¶ Bases:
wdom.node.CharacterDataComment node class.
-
html¶ Return html representation.
Return type: str
-
-
class
wdom.node.DocumentType(type: str = 'html', parent: wdom.node.Node = None) → None[source]¶ Bases:
wdom.node.Node,wdom.node.NonDocumentTypeChildNodeDocumentType node class.
Initialize DocumentType node with type doctype.
-
nodeName¶ Return node name (=type).
Return type: str
-
name¶ Return node type.
Return type: str
-
html¶ Return html representation.
Return type: str
-
-
class
wdom.node.DocumentFragment(parent: wdom.node.AbstractNode = None) → None[source]¶ Bases:
wdom.node.Node,wdom.node.ParentNodeDocumentFragument node class.
Initialize node object with parent node.
Parameters: parent (Node) – parent node. -
html¶ Return html representation.
Return type: str
-
-
class
wdom.document.Document(*, doctype: str = 'html', default_class: type = <class 'wdom.element.HTMLElement'>, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.node.Node,wdom.node.ParentNode,wdom.event.EventTargetBase class for Document node.
Create new Document node.
Parameters: - doctype (str) – Document type of this document.
- default_class (type) – Default class created by
createElement()method.
-
getElementsBy(cond)¶ Return list of child elements of start_node which matches
cond.condmust be a function which gets a single argumentElement, and returns boolean. If the node matches requested condition,condshould return True. This searches all child elements recursively.Parameters: - start_node (ParentNode) –
- cond – Callable[[Element], bool]
Return type:
-
getElementsByClassName(class_name)¶ Get child nodes which has
class_nameclass attribute.Return type: NodeList[]
-
doctype¶ Return DocumentType element of this document.
Return type: DocumentType
-
characterSet¶ Get/Set charset of this document.
Return type: str
-
title¶ Get/Set title string of this document.
Return type: str
-
getElementById(id)[source]¶ Get element by
id.If this document does not have the element with the id, return None.
Return type: Optional[Node]
-
createDocumentFragment()[source]¶ Create empty document fragment.
Return type: DocumentFragment
-
class
wdom.element.Attr(name: str, value: typing.Union[typing.List[str], str, int, wdom.css.CSSStyleDeclaration, NoneType] = None, owner: wdom.node.Node = None) → None[source]¶ Bases:
objectAttribute node.
In the latest DOM specification, Attr interface does not inherits
Nodeinterface. (Previously, Attr inherited Node interface.)Initialize this attribute.
Parameters: - name (str) – property name.
- value (_AttrValueType) – attribute value.
- owner (Node) – owner node of this attribute (optional).
-
html¶ Return string representation of this.
Used in start tag of HTML representation of the Element node.
Return type: str
-
name¶ Name of this attr.
Return type: str
-
value¶ Value of this attr.
Return type: Union[List[str],str,int,CSSStyleDeclaration,None]
-
isId¶ Return True if this Attr is an ID node (name is
id).Return type: bool
-
class
wdom.element.Element(tag: str = '', parent: wdom.node.Node = None, _registered: bool = True, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.node.Node,wdom.event.EventTarget,wdom.node.ParentNode,wdom.node.NonDocumentTypeChildNode,wdom.node.ChildNodeElement base class.
Initialize.
Parameters: - tag (str) – HTML tag of this node.
- parent (Node) – Parent node of this node.
- _registered (bool) – Is registered to CustomElementRegistry.
- kwargs – key-value pair of attributes.
-
getElementsBy(cond)¶ Return list of child elements of start_node which matches
cond.condmust be a function which gets a single argumentElement, and returns boolean. If the node matches requested condition,condshould return True. This searches all child elements recursively.Parameters: - start_node (ParentNode) –
- cond – Callable[[Element], bool]
Return type:
-
getElementsByClassName(class_name)¶ Get child nodes which has
class_nameclass attribute.Return type: NodeList[]
-
start_tag¶ Return HTML start tag.
Return type: str
-
end_tag¶ Return HTML end tag.
Return type: str
-
innerHTML¶ Return HTML representation of child nodes.
Return type: str
-
html¶ Return HTML representation of this node.
Return type: str
-
insertAdjacentHTML(position, html)[source]¶ Parse
htmlto DOM and insert toposition.positionis a case-insensive string, and must be one of “beforeBegin”, “afterBegin”, “beforeEnd”, or “afterEnd”.Return type: None
-
outerHTML¶ Return html representation of this node.
Equivalent to
self.html.Return type: str
-
nodeName¶ Return tag name (capital case).
Return type: str
-
tagName¶ Return tag name (capital case).
Return type: str
-
localName¶ Return tag name (lower case).
Return type: str
-
className¶ Get/Set class name as/by string.
Return type: str
-
getAttribute(attr)[source]¶ Get attribute of this node as string format.
If this node does not have
attr, return None.Return type: Union[List[str],str,int,CSSStyleDeclaration,None]
-
getAttributeNode(attr)[source]¶ Get attribute of this node as Attr format.
If this node does not have
attr, return None.Return type: Optional[Attr]
-
id¶ Getter: Get value of
idattribute of this element, as string. If id is not defined, return empty string. Setter: Set the value ofidattribute of this element. Deleter: Removeidattribute from this element.Return type: str
-
class
wdom.element.HTMLElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.ElementBase class for HTMLElement.
This class extends Element class with some HTML specific features.
-
end_tag¶ Retrun html end tag.
If tag is empty tag like <img> or <br>, return empty string.
Return type: str
-
style¶ Return style attribute of this node.
Return type: CSSStyleDeclaration
-
draggable¶ Get
draggableproperty.Return type: Union[bool,str]
Getter: Return True if this element has
hiddenattribute. Otherwise return False. Setter: If True, addhiddenattribute to this element. Otherwise removehidden. Deleter: Removehiddenattribute from this element.Return type: bool
-
title¶ Getter: Get value of
titleattribute of this element, as string. If title is not defined, return empty string. Setter: Set the value oftitleattribute of this element. Deleter: Removetitleattribute from this element.Return type: str
-
type¶ Getter: Get value of
typeattribute of this element, as string. If type is not defined, return empty string. Setter: Set the value oftypeattribute of this element. Deleter: Removetypeattribute from this element.Return type: str
-
-
class
wdom.window.Window(document: wdom.node.Node) → None[source]¶ Bases:
wdom.event.WebEventTargetWindow base class.
Make new window object.
Parameters: document (Document) – root document of the window. -
customElements¶ Return customElementsRegistry object.
Return type: CustomElementsRegistry
-
Conclete HTML Elements¶
-
class
wdom.element.HTMLAnchorElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElementHTMLAnchorElement class (<a></a> tag).
-
href¶ Getter: Get value of
hrefattribute of this element, as string. If href is not defined, return empty string. Setter: Set the value ofhrefattribute of this element. Deleter: Removehrefattribute from this element.Return type: str
-
name¶ Getter: Get value of
nameattribute of this element, as string. If name is not defined, return empty string. Setter: Set the value ofnameattribute of this element. Deleter: Removenameattribute from this element.Return type: str
-
rel¶ Getter: Get value of
relattribute of this element, as string. If rel is not defined, return empty string. Setter: Set the value ofrelattribute of this element. Deleter: Removerelattribute from this element.Return type: str
-
src¶ Getter: Get value of
srcattribute of this element, as string. If src is not defined, return empty string. Setter: Set the value ofsrcattribute of this element. Deleter: Removesrcattribute from this element.Return type: str
-
target¶ Getter: Get value of
targetattribute of this element, as string. If target is not defined, return empty string. Setter: Set the value oftargetattribute of this element. Deleter: Removetargetattribute from this element.Return type: str
-
-
class
wdom.element.HTMLButtonElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElementHTMLButtonElement class (<button></button> tag).
-
disabled¶ Getter: Return True if this element has
disabledattribute. Otherwise return False. Setter: If True, adddisabledattribute to this element. Otherwise removedisabled. Deleter: Removedisabledattribute from this element.Return type: bool
-
name¶ Getter: Get value of
nameattribute of this element, as string. If name is not defined, return empty string. Setter: Set the value ofnameattribute of this element. Deleter: Removenameattribute from this element.Return type: str
-
value¶ Getter: Get value of
valueattribute of this element, as string. If value is not defined, return empty string. Setter: Set the value ofvalueattribute of this element. Deleter: Removevalueattribute from this element.Return type: str
-
-
class
wdom.element.HTMLFormElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElementHTMLFormElement class (<form></form> tag).
-
name¶ Getter: Get value of
nameattribute of this element, as string. If name is not defined, return empty string. Setter: Set the value ofnameattribute of this element. Deleter: Removenameattribute from this element.Return type: str
-
-
class
wdom.element.HTMLIFrameElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElementHTMLIFrameElement class (<iframe></iframe> tag).
-
height¶ Getter: Get value of
heightattribute of this element, as string. If height is not defined, return empty string. Setter: Set the value ofheightattribute of this element. Deleter: Removeheightattribute from this element.Return type: str
-
name¶ Getter: Get value of
nameattribute of this element, as string. If name is not defined, return empty string. Setter: Set the value ofnameattribute of this element. Deleter: Removenameattribute from this element.Return type: str
-
src¶ Getter: Get value of
srcattribute of this element, as string. If src is not defined, return empty string. Setter: Set the value ofsrcattribute of this element. Deleter: Removesrcattribute from this element.Return type: str
-
target¶ Getter: Get value of
targetattribute of this element, as string. If target is not defined, return empty string. Setter: Set the value oftargetattribute of this element. Deleter: Removetargetattribute from this element.Return type: str
-
width¶ Getter: Get value of
widthattribute of this element, as string. If width is not defined, return empty string. Setter: Set the value ofwidthattribute of this element. Deleter: Removewidthattribute from this element.Return type: str
-
-
class
wdom.element.HTMLInputElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElement,wdom.element.FormControlMixinHTMLInputElement class (<input></input> tag).
-
defaultChecked¶ Property is this control checked by default.
Return type: bool
-
defaultValue¶ Defatul value of this node.
Return type: Union[List[str],str,int,CSSStyleDeclaration,None]
-
checked¶ Getter: Return True if this element has
checkedattribute. Otherwise return False. Setter: If True, addcheckedattribute to this element. Otherwise removechecked. Deleter: Removecheckedattribute from this element.Return type: bool
-
disabled¶ Getter: Return True if this element has
disabledattribute. Otherwise return False. Setter: If True, adddisabledattribute to this element. Otherwise removedisabled. Deleter: Removedisabledattribute from this element.Return type: bool
-
height¶ Getter: Get value of
heightattribute of this element, as string. If height is not defined, return empty string. Setter: Set the value ofheightattribute of this element. Deleter: Removeheightattribute from this element.Return type: str
-
multiple¶ Getter: Return True if this element has
multipleattribute. Otherwise return False. Setter: If True, addmultipleattribute to this element. Otherwise removemultiple. Deleter: Removemultipleattribute from this element.Return type: bool
-
name¶ Getter: Get value of
nameattribute of this element, as string. If name is not defined, return empty string. Setter: Set the value ofnameattribute of this element. Deleter: Removenameattribute from this element.Return type: str
-
readonly¶ Getter: Return True if this element has
readonlyattribute. Otherwise return False. Setter: If True, addreadonlyattribute to this element. Otherwise removereadonly. Deleter: Removereadonlyattribute from this element.Return type: bool
-
required¶ Getter: Return True if this element has
requiredattribute. Otherwise return False. Setter: If True, addrequiredattribute to this element. Otherwise removerequired. Deleter: Removerequiredattribute from this element.Return type: bool
-
src¶ Getter: Get value of
srcattribute of this element, as string. If src is not defined, return empty string. Setter: Set the value ofsrcattribute of this element. Deleter: Removesrcattribute from this element.Return type: str
-
value¶ Getter: Get value of
valueattribute of this element, as string. If value is not defined, return empty string. Setter: Set the value ofvalueattribute of this element. Deleter: Removevalueattribute from this element.Return type: str
-
width¶ Getter: Get value of
widthattribute of this element, as string. If width is not defined, return empty string. Setter: Set the value ofwidthattribute of this element. Deleter: Removewidthattribute from this element.Return type: str
-
-
class
wdom.element.HTMLLabelElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElement,wdom.element.FormControlMixinHTMLLabelElement class (<label></label> tag).
-
htmlFor¶ Retrun
forattribute value.Return type: Union[List[str],str,int,CSSStyleDeclaration,None]
-
control¶ Return related HTMLElement object.
Return type: Optional[HTMLElement]
-
-
class
wdom.element.HTMLOptGroupElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElement,wdom.element.FormControlMixinHTMLOptionElement class (<optgroup></optgroup> tag).
-
disabled¶ Getter: Return True if this element has
disabledattribute. Otherwise return False. Setter: If True, adddisabledattribute to this element. Otherwise removedisabled. Deleter: Removedisabledattribute from this element.Return type: bool
-
label¶ Getter: Get value of
labelattribute of this element, as string. If label is not defined, return empty string. Setter: Set the value oflabelattribute of this element. Deleter: Removelabelattribute from this element.Return type: str
-
-
class
wdom.element.HTMLOptionElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElement,wdom.element.FormControlMixinHTMLOptionElement class (<option></option> tag).
-
defaultSelected¶ Getter: Return True if this element has
defaultSelectedattribute. Otherwise return False. Setter: If True, adddefaultSelectedattribute to this element. Otherwise removedefaultSelected. Deleter: RemovedefaultSelectedattribute from this element.Return type: bool
-
disabled¶ Getter: Return True if this element has
disabledattribute. Otherwise return False. Setter: If True, adddisabledattribute to this element. Otherwise removedisabled. Deleter: Removedisabledattribute from this element.Return type: bool
-
label¶ Getter: Get value of
labelattribute of this element, as string. If label is not defined, return empty string. Setter: Set the value oflabelattribute of this element. Deleter: Removelabelattribute from this element.Return type: str
-
selected¶ Getter: Return True if this element has
selectedattribute. Otherwise return False. Setter: If True, addselectedattribute to this element. Otherwise removeselected. Deleter: Removeselectedattribute from this element.Return type: bool
-
value¶ Getter: Get value of
valueattribute of this element, as string. If value is not defined, return empty string. Setter: Set the value ofvalueattribute of this element. Deleter: Removevalueattribute from this element.Return type: str
-
-
class
wdom.element.HTMLScriptElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElementHTMLScriptElement class (<script></script> tag).
In this tag, all inner contents are not escaped.
-
async¶ Getter: Return True if this element has
asyncattribute. Otherwise return False. Setter: If True, addasyncattribute to this element. Otherwise removeasync. Deleter: Removeasyncattribute from this element.Return type: bool
-
charset¶ Getter: Get value of
charsetattribute of this element, as string. If charset is not defined, return empty string. Setter: Set the value ofcharsetattribute of this element. Deleter: Removecharsetattribute from this element.Return type: str
-
defer¶ Getter: Return True if this element has
deferattribute. Otherwise return False. Setter: If True, adddeferattribute to this element. Otherwise removedefer. Deleter: Removedeferattribute from this element.Return type: bool
-
src¶ Getter: Get value of
srcattribute of this element, as string. If src is not defined, return empty string. Setter: Set the value ofsrcattribute of this element. Deleter: Removesrcattribute from this element.Return type: str
-
-
class
wdom.element.HTMLSelectElement(*args: typing.Any, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElement,wdom.element.FormControlMixinHTMLSelectElement class (<select></select> tag).
-
length¶ Return number of options in this node.
Return type: int
-
disabled¶ Getter: Return True if this element has
disabledattribute. Otherwise return False. Setter: If True, adddisabledattribute to this element. Otherwise removedisabled. Deleter: Removedisabledattribute from this element.Return type: bool
-
multiple¶ Getter: Return True if this element has
multipleattribute. Otherwise return False. Setter: If True, addmultipleattribute to this element. Otherwise removemultiple. Deleter: Removemultipleattribute from this element.Return type: bool
-
name¶ Getter: Get value of
nameattribute of this element, as string. If name is not defined, return empty string. Setter: Set the value ofnameattribute of this element. Deleter: Removenameattribute from this element.Return type: str
-
required¶ Getter: Return True if this element has
requiredattribute. Otherwise return False. Setter: If True, addrequiredattribute to this element. Otherwise removerequired. Deleter: Removerequiredattribute from this element.Return type: bool
-
size¶ Getter: Get value of
sizeattribute of this element, as string. If size is not defined, return empty string. Setter: Set the value ofsizeattribute of this element. Deleter: Removesizeattribute from this element.Return type: str
-
value¶ Getter: Get value of
valueattribute of this element, as string. If value is not defined, return empty string. Setter: Set the value ofvalueattribute of this element. Deleter: Removevalueattribute from this element.Return type: str
-
-
class
wdom.element.HTMLStyleElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElementHTMLStyleElement class (<style></style> tag).
In this tag, all inner contents are not escaped.
-
disabled¶ Getter: Return True if this element has
disabledattribute. Otherwise return False. Setter: If True, adddisabledattribute to this element. Otherwise removedisabled. Deleter: Removedisabledattribute from this element.Return type: bool
-
scoped¶ Getter: Return True if this element has
scopedattribute. Otherwise return False. Setter: If True, addscopedattribute to this element. Otherwise removescoped. Deleter: Removescopedattribute from this element.Return type: bool
-
-
class
wdom.element.HTMLTextAreaElement(*args: typing.Any, style: str = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElement,wdom.element.FormControlMixinHTMLTextAreaElement class (<textarea></textarea> tag).
-
disabled¶ Getter: Return True if this element has
disabledattribute. Otherwise return False. Setter: If True, adddisabledattribute to this element. Otherwise removedisabled. Deleter: Removedisabledattribute from this element.Return type: bool
-
height¶ Getter: Get value of
heightattribute of this element, as string. If height is not defined, return empty string. Setter: Set the value ofheightattribute of this element. Deleter: Removeheightattribute from this element.Return type: str
-
name¶ Getter: Get value of
nameattribute of this element, as string. If name is not defined, return empty string. Setter: Set the value ofnameattribute of this element. Deleter: Removenameattribute from this element.Return type: str
-
src¶ Getter: Get value of
srcattribute of this element, as string. If src is not defined, return empty string. Setter: Set the value ofsrcattribute of this element. Deleter: Removesrcattribute from this element.Return type: str
-
value¶ Getter: Get value of
valueattribute of this element, as string. If value is not defined, return empty string. Setter: Set the value ofvalueattribute of this element. Deleter: Removevalueattribute from this element.Return type: str
-
width¶ Getter: Get value of
widthattribute of this element, as string. If width is not defined, return empty string. Setter: Set the value ofwidthattribute of this element. Deleter: Removewidthattribute from this element.Return type: str
-
defaultValue¶ Return text contents of this node and all chid nodes.
When any value is set to this property, all child nodes are removed and new value is set as a text node.
Return type: str
-
Node Collectoin Classes¶
-
class
wdom.node.NodeList(nodes: typing.Sequence[wdom.node.Node]) → None[source]¶ Bases:
typing.SequenceCollection of Node objects.
Initialize NodeList by iterable nodes.
-
length¶ Return number of nodes in this list.
Return type: int
-
-
class
wdom.element.DOMTokenList(owner: typing.Union[wdom.node.Node, typing.Type[_ForwardRef('HTMLElement')]], *args: typing.Union[str, _ForwardRef('DOMTokenList')]) → None[source]¶ Bases:
typing.MutableSequenceCollection of DOM token strings.
DOM token is a string which does not contain spases. This class is mainly used for class list.
Initialize with owner node (maybe type of node) and initial values.
Parameters: - owner – Node/Node-class which has this collection.
- args – space-separated string or iterable of tokens.
-
length¶ Get number of DOM token in this list.
Return type: int
-
toggle(token)[source]¶ Add or remove token to/from list.
If token is in this list, the token will be removed. Otherwise add it to list.
Return type: None
-
class
wdom.element.NamedNodeMap(owner: wdom.node.Node) → None[source]¶ Bases:
collections.UserDictCollection of Attr objects.
Initialize with owner node.
Parameters: owner (Node) – owner node of this object. -
length¶ Return number of Attrs in this collection.
Return type: int
-
getNamedItem(name)[source]¶ Get
Attrobject which hasname.If does not have
nameattr, return None.Return type: Optional[Attr]
-
Abstract classes¶
-
class
wdom.node.ParentNode[source]¶ Bases:
wdom.node.AbstractNodeMixin class for Node classes which can have child nodes.
This class is inherited by Document, DocumentFragment, and Element class.
-
firstElementChild¶ First Element child node.
If this node has no element child, return None.
Return type: Optional[AbstractNode]
-
lastElementChild¶ Last Element child node.
If this node has no element child, return None.
Return type: Optional[AbstractNode]
-
query(relativeSelectors)[source]¶ Not Implemented.
Return type: AbstractNode
-
querySelector(selectors)[source]¶ Not Implemented.
Return type: AbstractNode
-
-
class
wdom.node.NonDocumentTypeChildNode[source]¶ Bases:
wdom.node.AbstractNodeMixin class for
CharacterDataandDocumentTypeclass.-
previousElementSibling¶ Previous Element Node.
If this node has no previous element node, return None.
Return type: Optional[AbstractNode]
-
nextElementSibling¶ Next Element Node.
If this node has no next element node, return None.
Return type: Optional[AbstractNode]
-
-
class
wdom.node.ChildNode[source]¶ Bases:
wdom.node.AbstractNodeMixin class for Node classes which can have parent node.
This class is inherited by DocumentType, Element, and CharacterData (super class of Text, Comment, and RawHtml) classes.
-
before(*nodes)[source]¶ Insert nodes before this node.
If nodes contains
str, it will be converted to Text node.Return type: None
-
after(*nodes)[source]¶ Append nodes after this node.
If nodes contains
str, it will be converted to Text node.Return type: None
-
-
class
wdom.node.CharacterData(text: str = '', parent: wdom.node.Node = None) → None[source]¶ Bases:
wdom.node.Node,wdom.node.ChildNode,wdom.node.NonDocumentTypeChildNodeAbstract class for classes which wraps text data.
This class is a super class of
TextandComment.-
html¶ Return html representation of this node.
Return type: str
-
length¶ Return length of content.
Return type: int
-
replaceData(offset, count, string)[source]¶ Replace data from offset to count by string.
Return type: None
-
WdomElement class (base class of Tag)¶
-
class
wdom.web_node.WdomElement(*args: typing.Any, parent: typing.Union[wdom.web_node.WdomElement, NoneType] = None, wdom_id: typing.Union[int, str] = None, **kwargs: typing.Any) → None[source]¶ Bases:
wdom.element.HTMLElement,wdom.event.WebEventTargetWdomElement class.
This class provides main features to synchronously control browser DOM node.
Additionally, this class provides shortcut properties to handle class attributes.
-
class_= ''¶ str and list of strs are acceptale.
-
inherit_class= True¶ Inherit classes defined in super class or not. By default, this variable is True.
-
wdom_id¶ Get wdom_id attribute.
This attribute is used to relate python node and browser DOM node.
Return type: str
-
rimo_id¶ [Deprecated] Alias to wdom_id.
rimo_id is renamed to wdom_id.
Return type: str
-
connected¶ When this instance has any connection, return True.
Return type: bool
-
classmethod
get_class_list()[source]¶ Get class-level class list, including all super class’s.
Return type: DOMTokenList[]
-
hasClass(class_)[source]¶ [Not Standard] Return if this node has
class_class or not.Return type: bool
-
appendChild(child)[source]¶ Append child node at the last of child nodes.
If this instance is connected to the node on browser, the child node is also added to it.
Return type: Node
-
insertBefore(child, ref_node)[source]¶ Insert new child node before the reference child node.
If the reference node is not a child of this node, raise ValueError. If this instance is connected to the node on browser, the child node is also added to it.
Return type: Node
-
removeChild(child)[source]¶ Remove the child node from this node.
If the node is not a child of this node, raise ValueError.
Return type: Node
-
textContent¶ Return text contents of this node and all chid nodes.
When any value is set to this property, all child nodes are removed and new value is set as a text node.
Return type: str
-
innerHTML¶ Return HTML representation of child nodes.
Return type: str
-
html_noid¶ Get html representation of this node without wdom_id.
Return type: str
-