public addSelfClosingTag ( string | array $tag ) | ||
$tag | string | array |
public function addSelfClosingTag($tag)
{
if (!is_array($tag)) {
$tag = [$tag];
}
foreach ($tag as $value) {
$this->selfClosing[] = $value;
}
return $this;
}
public function testLoadClosingTagAddSelfClosingTagArray() { $dom = new Dom(); $dom->addSelfClosingTag(['mytag', 'othertag']); $dom->load('<div class="all"><mytag><p>Hey bro, <a href="google.com" data-quote="\\"">click here</a><othertag></div>'); $this->assertEquals('<mytag /><p>Hey bro, <a href="google.com" data-quote="\\"">click here</a><othertag /></p>', $dom->find('div', 0)->innerHtml); }