The setVoid()
method is used to define whether an element should be treated as a void element.
Void elements do not have a closing tag and are self-closed, represented with a slash at the end of the opening tag (e.g.,
<div/>
instead of<div></div>
).
Description
public ElementNode::setVoid(bool $void): static
Parameters
void
A bool
that determines whether the element is void. true
makes the element void (self-closing), while false
restores the element to have both opening and closing tags.
Return Value
Returns the current instance of ElementNode
(static
), allowing for method chaining.
Exceptions
None