KDE 4.9 PyKDE API Reference

- KDE's Python API

# HTMLElement Class Reference

`from PyKDE4.khtml import *`

Inherits: DOM.Element → DOM.Node
Subclasses: DOM.HTMLBodyElement, DOM.HTMLFrameElement, DOM.HTMLFrameSetElement, DOM.HTMLIFrameElement, DOM.HTMLHeadElement, DOM.HTMLHtmlElement, DOM.HTMLBlockquoteElement, DOM.HTMLDivElement, DOM.HTMLHRElement, DOM.HTMLHeadingElement, DOM.HTMLParagraphElement, DOM.HTMLPreElement, DOM.HTMLLayerElement, DOM.HTMLButtonElement, DOM.HTMLFieldSetElement, DOM.HTMLFormElement, DOM.HTMLInputElement, DOM.HTMLLabelElement, DOM.HTMLLegendElement, DOM.HTMLOptGroupElement, DOM.HTMLSelectElement, DOM.HTMLTextAreaElement, DOM.HTMLOptionElement, DOM.HTMLIsIndexElement, DOM.HTMLBaseElement, DOM.HTMLLinkElement, DOM.HTMLMetaElement, DOM.HTMLScriptElement, DOM.HTMLStyleElement, DOM.HTMLTitleElement, DOM.HTMLAreaElement, DOM.HTMLImageElement, DOM.HTMLMapElement, DOM.HTMLAnchorElement, DOM.HTMLBRElement, DOM.HTMLFontElement, DOM.HTMLModElement, DOM.HTMLQuoteElement, DOM.HTMLDListElement, DOM.HTMLDirectoryElement, DOM.HTMLLIElement, DOM.HTMLMenuElement, DOM.HTMLOListElement, DOM.HTMLUListElement, DOM.HTMLBaseFontElement, DOM.HTMLAppletElement, DOM.HTMLObjectElement, DOM.HTMLParamElement, DOM.HTMLTableCaptionElement, DOM.HTMLTableCellElement, DOM.HTMLTableColElement, DOM.HTMLTableElement, DOM.HTMLTableRowElement, DOM.HTMLTableSectionElement
Namespace: DOM

## Detailed Description

All HTML element interfaces derive from this class. Elements that only expose the HTML core attributes are represented by the base HTMLElement interface. These elements are as follows:

- HEAD

- special: <tt> SUB, SUP, SPAN, BDO </tt>

- font: <tt> TT, I, B, U, S, STRIKE, BIG, SMALL </tt>

- phrase: <tt> EM, STRONG, DFN, CODE, SAMP, KBD, VAR,
CITE, ACRONYM, ABBR</tt>

- list: <tt> DD, DT </tt>

- <tt> NOFRAMES, NOSCRIPT </tt>

- <tt> ADDRESS, CENTER </tt>

Note: The style attribute for this interface is reserved for future usage.

## Methods

| __init__ (self)
| __init__ (self, DOM.HTMLElement other)
| __init__ (self, DOM.Node other)
| addCSSProperty (self, DOM.DOMString property, DOM.DOMString value)
DOM.HTMLCollection | all (self)
| assignOther (self, DOM.Node other, int elementId)
DOM.HTMLCollection | children (self)
DOM.DOMString | className (self)
DOM.DOMString | contentEditable (self)
DOM.DOMString | dir (self)
DOM.DOMString | id (self)
DOM.DOMString | innerHTML (self)
DOM.DOMString | innerText (self)
bool | isContentEditable (self)
DOM.DOMString | lang (self)
| removeCSSProperty (self, DOM.DOMString property)
| setClassName (self, DOM.DOMString a0)
| setContentEditable (self, DOM.DOMString enabled)
| setDir (self, DOM.DOMString a0)
| setId (self, DOM.DOMString a0)
| setInnerHTML (self, DOM.DOMString html)
| setInnerText (self, DOM.DOMString text)
| setLang (self, DOM.DOMString a0)
| setTitle (self, DOM.DOMString a0)
DOM.DOMString | title (self)

## Method Documentation

__init__ | ( |  | self ) |

__init__ | ( | self, |
|  | DOM.HTMLElement | other
| ) |  |  |

__init__ | ( | self, |
|  | DOM.Node | other
| ) |  |  |

addCSSProperty | ( | self, |
|  | DOM.DOMString | property,
|  | DOM.DOMString | value
| ) |  |  |

DOM.HTMLCollection all | ( |  | self ) |

Retrieves a collection of all nodes that descend from this node. IE-specific extension.

assignOther | ( | self, |
|  | DOM.Node | other,
|  | int | elementId
| ) |  |  |

DOM.HTMLCollection children | ( |  | self ) |

Retrieves a collection of nodes that are direct descendants of this node. IE-specific extension.

DOM.DOMString className | ( |  | self ) |

The class attribute of the element. This attribute has been renamed due to conflicts with the "class" keyword exposed by many languages. See the <a href="http://www.w3.org/TR/REC-html40/struct/global.html#adef-class"> class attribute definition in HTML 4.0.

DOM.DOMString contentEditable | ( |  | self ) |

Returns the kind of editability that applies to this element.

The returned string is one of:

- true: This element has been set to be editable.
- false: This element has been set not to be editable.
- inherit: This element inherits its editability from the parent.

This function is not part of the DOM specifications as defined by the w3c.

DOM.DOMString dir | ( |  | self ) |

Specifies the base direction of directionally neutral text and the directionality of tables. See the <a href="http://www.w3.org/TR/REC-html40/struct/dirlang.html#adef-dir"> dir attribute definition in HTML 4.0.

DOM.DOMString id | ( |  | self ) |

The element's identifier. See the <a href="http://www.w3.org/TR/REC-html40/struct/global.html#adef-id"> id attribute definition in HTML 4.0.

DOM.DOMString innerHTML | ( |  | self ) |

The HTML code contained in this element. This function is not part of the DOM specifications as defined by the w3c.

DOM.DOMString innerText | ( |  | self ) |

The text contained in this element. This function is not part of the DOM specifications as defined by the w3c.

bool isContentEditable | ( |  | self ) |

Returns whether this element is editable.

This function is not part of the DOM specifications as defined by the w3c.

DOM.DOMString lang | ( |  | self ) |

Language code defined in RFC 1766. See the <a href="http://www.w3.org/TR/REC-html40/struct/dirlang.html#adef-lang"> lang attribute definition in HTML 4.0.

removeCSSProperty | ( | self, |
|  | DOM.DOMString | property
| ) |  |  |

setClassName | ( | self, |
|  | DOM.DOMString | a0
| ) |  |  |

see className

setContentEditable | ( | self, |
|  | DOM.DOMString | enabled
| ) |  |  |

Sets the editability of this element.

This function is not part of the DOM specifications as defined by the w3c.

Parameters:

  | enabled | may be one of:

- true: make element editable
- false: make element not editable
- inherit: make element inherit editability from parent.

setDir | ( | self, |
|  | DOM.DOMString | a0
| ) |  |  |

see dir

setId | ( | self, |
|  | DOM.DOMString | a0
| ) |  |  |

see id

setInnerHTML | ( | self, |
|  | DOM.DOMString | html
| ) |  |  |

Set the HTML content of this node.

DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if there is the element does not allow children.

setInnerText | ( | self, |
|  | DOM.DOMString | text
| ) |  |  |

Set the text content of this node.

DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if there is the element does not allow children.

setLang | ( | self, |
|  | DOM.DOMString | a0
| ) |  |  |

see lang

setTitle | ( | self, |
|  | DOM.DOMString | a0
| ) |  |  |

see title

DOM.DOMString title | ( |  | self ) |

The element's advisory title. See the <a href="http://www.w3.org/TR/REC-html40/struct/global.html#adef-title"> title attribute definition in HTML 4.0.