Allow autoplay attribute of <audio> and <video> tags #1187

This commit is contained in:
Kijin Sung 2019-08-13 15:11:08 +09:00
parent 553ae9ce98
commit d8fa31722c
2 changed files with 5 additions and 3 deletions

View file

@ -235,6 +235,7 @@ class HTMLFilter
'preload' => 'Enum#auto,metadata,none',
'controls' => 'Bool',
'muted' => 'Bool',
'autoplay' => 'Bool',
'loop' => 'Bool',
));
$def->addElement('video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', array(
@ -246,6 +247,7 @@ class HTMLFilter
'preload' => 'Enum#auto,metadata,none',
'controls' => 'Bool',
'muted' => 'Bool',
'autoplay' => 'Bool',
'loop' => 'Bool',
));
$def->addElement('source', 'Block', 'Empty', 'Common', array(

View file

@ -69,11 +69,11 @@ class HTMLFilterTest extends \Codeception\TestCase\Test
public function testHTMLFilterHTML5()
{
$source = '<div><audio autoplay="autoplay" src="./foo/bar.mp3"></audio></div>';
$target = '<div><audio src="./foo/bar.mp3"></audio></div>';
$target = '<div><audio autoplay="" src="./foo/bar.mp3"></audio></div>';
$this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source));
$source = '<video autoplay="autoplay" width="320" height="240"><source src="./foo/bar.mp4" type="video/mp4" /></video>';
$target = '<video width="320" height="240"><source src="./foo/bar.mp4" type="video/mp4" /></video>';
$source = '<video autoplay width="320" height="240"><source src="./foo/bar.mp4" type="video/mp4" /></video>';
$target = '<video autoplay="" width="320" height="240"><source src="./foo/bar.mp4" type="video/mp4" /></video>';
$this->assertEquals($target, Rhymix\Framework\Filters\HTMLFilter::clean($source));
$source = '<nav>123</nav><section>456</section><article>789</article><aside>0</aside>';