BaseElement: easier way to override isVoid

This commit is contained in:
Thomas Gelf 2018-02-20 14:38:32 +01:00
parent 20bcbdccf7
commit 5a5cd9ba1e
1 changed files with 14 additions and 1 deletions

View File

@ -32,6 +32,8 @@ abstract class BaseElement extends Html
'wbr'
];
protected $isVoid;
/**
* @return Attributes
*/
@ -165,7 +167,18 @@ abstract class BaseElement extends Html
public function isVoidElement()
{
return in_array($this->tag, self::$voidElements);
if ($this->isVoid === null) {
$this->isVoid = in_array($this->tag, self::$voidElements);
}
return $this->isVoid;
}
public function setVoid($void = true)
{
$this->isVoid = $void;
return $this;
}
/**