The OpenD Programming Language

Element.isEmpty

Returns if the node would be printed to string as <tag /> or <tag></tag>. In other words, if it has no non-empty text nodes and no element nodes. Please note that whitespace text nodes are NOT considered empty; Html("<tag> </tag>").isEmpty == false.

More...
class Element
const
bool
isEmpty
()

Detailed Description

The value is undefined if there are comment or processing instruction nodes. The current implementation returns false if it sees those, assuming the nodes haven't been stripped out during parsing. But I'm not married to the current implementation and reserve the right to change it without notice.

Meta

History

Added December 3, 2021 (dub v10.5)