type

DocElem

src @Js
abstract class DocElem : DocNode

DocElem is a container node which models a branch of the doc tree.

See pod doc for usage.

fields

methods

add

Add a child to this node.

addAll

Convenicence to call add for each node in the given list.

addChild
children

Get a readonly list of this elements's children.

eachChild

Iterate the children nodes

htmlName

Get the HTML element name to use for this element.

insert

Insert a child node at the specified index.

path

Covariant override to narrow path to list of DocElem.

remove

Remove a child node.

removeAll

Remove all child nodes.

toText

Get all the DocText children as a string

write

Write this element and its children to the specified DocWriter.

writeChildren

Write this element's children to the specified DocWriter.

Slot Details

add

src @Operator
This add(DocNode node)

Add a child to this node. If adding a text node it is automatically merged with the trailing text node (if applicable). If the node is arlready parented thorw ArgErr. Return this.

addAll

src This addAll(DocNode[] nodes)

Convenicence to call add for each node in the given list.

addChild

src @Deprecated { msg="Use add()" }
This addChild(DocNode node)

anchorId

src Str? anchorId

children

src DocNode[] children()

Get a readonly list of this elements's children.

eachChild

src Void eachChild(|DocNode| f)

Iterate the children nodes

htmlName

src abstract Str htmlName()

Get the HTML element name to use for this element.

insert

src This insert(Int index, DocNode node)

Insert a child node at the specified index. A negative index may be used to access an index from the end of the list. If adding a text node it is automatically merged with surrounding text nodes (if applicable). If the node is already parented throws ArgErr.

path

src override DocElem[] path()

Covariant override to narrow path to list of DocElem.

remove

src This remove(DocNode node)

Remove a child node. If this element is not the child's current parent throw ArgErr. Return this.

removeAll

src This removeAll()

Remove all child nodes. Return this.

toText

src virtual override Str toText()

Get all the DocText children as a string

write

src virtual override Void write(DocWriter out)

Write this element and its children to the specified DocWriter.

writeChildren

src Void writeChildren(DocWriter out)

Write this element's children to the specified DocWriter.