Adds the tag (or tags in an array) to the list of tags that will always
be self closing.
public addSelfClosingTag ( string | array $tag ) | ||
$tag | string | array |
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); }