Element

class Element(val tag: String, var attrs: Map<String, String>, val children: MutableList<KiteXmlNode> = ArrayList()) : KiteXmlNode(source)

Constructors

Link copied to clipboard
constructor(tag: String, attrs: Map<String, String>, children: MutableList<KiteXmlNode> = ArrayList())

Properties

Link copied to clipboard

The attributes, by name. A script layer replaces the map when a script sets or removes one, on a tree of its own that no layout reads meanwhile (#41).

Link copied to clipboard
Link copied to clipboard

Enclosing element, set by the tree builder when the child is appended, and null at the root. CSS selector matching needs it for sibling combinators and the child-indexed pseudo-classes.

Link copied to clipboard
val tag: String

Functions

Link copied to clipboard

This element's index in its parent's children, or -1 when it has none or is not among them. The answer is remembered and checked on the next call, so a selector's sibling step costs O(1) where a scan of the parent from its first child cost the element's position, and h1 ~ p over n siblings cost n^3/6 (#990). A tree that changed since is scanned again.