Skip to content

Commit

Permalink
Remove problematic attrs from video and audio
Browse files Browse the repository at this point in the history
  • Loading branch information
xemlock committed May 7, 2017
1 parent 45265be commit 2ec7706
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
26 changes: 9 additions & 17 deletions library/HTMLPurifier/HTML5Definition.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,18 @@ public static function setup(HTMLPurifier_HTMLDefinition $def)

// http://developers.whatwg.org/the-video-element.html#the-video-element
$def->addElement('video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', array(
'autoplay' => 'Bool',
'controls' => 'Bool',
'height' => 'Length',
'loop' => 'Bool',
'mediagroup' => 'Text',
'muted' => 'Bool',
'poster' => 'URI',
'preload' => 'Enum#auto,metadata,none',
'src' => 'URI',
'width' => 'Length',
'controls' => 'Bool',
'height' => 'Length',
'poster' => 'URI',
'preload' => 'Enum#auto,metadata,none',
'src' => 'URI',
'width' => 'Length',
));
// http://developers.whatwg.org/the-video-element.html#the-audio-element
$def->addElement('audio', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', array(
'autoplay' => 'Bool',
'controls' => 'Bool',
'loop' => 'Bool',
'mediagroup' => 'Text',
'muted' => 'Bool',
'preload' => 'Enum#auto,metadata,none',
'src' => 'URI',
'controls' => 'Bool',
'preload' => 'Enum#auto,metadata,none',
'src' => 'URI',
));
$def->addElement('source', 'Block', 'Empty', 'Common', array('src' => 'URI', 'type' => 'Text'));

Expand Down
4 changes: 2 additions & 2 deletions tests/HTMLPurifier/HTML5DefinitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public function testFigure()

public function testAudio()
{
$input = '<audio controls autoplay loop><source src="audio.ogg" type="audio/ogg"></audio>';
$input = '<audio controls><source src="audio.ogg" type="audio/ogg"></audio>';
$output = $this->getPurifier()->purify($input);

$this->assertEquals($input, $output);
}

public function testVideo()
{
$input = '<video width="400" height="400" muted poster="poster.png"><source src="video.mp4" type="video/mp4"></video>';
$input = '<video width="400" height="400" poster="poster.png"><source src="video.mp4" type="video/mp4"></video>';
$output = $this->getPurifier()->purify($input);

$this->assertEquals($input, $output);
Expand Down

0 comments on commit 2ec7706

Please sign in to comment.