summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsmir Mustafic <[email protected]>2018-10-08 19:53:38 +0200
committerAsmir Mustafic <[email protected]>2018-10-08 19:53:38 +0200
commiteccd1f35c6a4e072ca6be552089534ea3d4c20f8 (patch)
tree1a2e6087b4f4d822b8a16e7878a6d049793ca23f
parentc7c7657e3c2ef21053164992038015089ed7bf7e (diff)
audio is not a block tag
see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio
-rw-r--r--src/HTML5/Elements.php2
-rw-r--r--test/HTML5/ElementsTest.php1
-rw-r--r--test/HTML5/Parser/DOMTreeBuilderTest.php26
3 files changed, 27 insertions, 2 deletions
diff --git a/src/HTML5/Elements.php b/src/HTML5/Elements.php
index 0e880e7..b45de89 100644
--- a/src/HTML5/Elements.php
+++ b/src/HTML5/Elements.php
@@ -83,7 +83,7 @@ class Elements
"area" => 9, // NORMAL | VOID_TAG
"article" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG
"aside" => 81, // NORMAL | AUTOCLOSE_P | BLOCK_TAG
- "audio" => 65, // NORMAL | BLOCK_TAG
+ "audio" => 1, // NORMAL
"b" => 1,
"base" => 9, // NORMAL | VOID_TAG
"bdi" => 1,
diff --git a/test/HTML5/ElementsTest.php b/test/HTML5/ElementsTest.php
index 629b561..f4b377a 100644
--- a/test/HTML5/ElementsTest.php
+++ b/test/HTML5/ElementsTest.php
@@ -393,7 +393,6 @@ class ElementsTest extends TestCase
'address',
'article',
'aside',
- 'audio',
'blockquote',
'canvas',
'dd',
diff --git a/test/HTML5/Parser/DOMTreeBuilderTest.php b/test/HTML5/Parser/DOMTreeBuilderTest.php
index 909de10..68cf612 100644
--- a/test/HTML5/Parser/DOMTreeBuilderTest.php
+++ b/test/HTML5/Parser/DOMTreeBuilderTest.php
@@ -679,4 +679,30 @@ EOM;
$dom = $this->parse($html);
$this->assertSame(1, $dom->getElementsByTagName('div')->item(0)->childNodes->length);
}
+
+ public function testIAudioInParagraph() {
+ $html = <<<EOM
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>testIllegalSelfClosingTag</title>
+ </head>
+ <body>
+ <p>
+ <audio preload="none" controls="controls">
+ <source src="https://example.com/test.mp3" type="audio/mpeg" />
+ Your browser does not support the audio element.
+ </audio>
+ </p>
+ </body>
+</html>>
+</html>
+EOM;
+
+ $dom = $this->parse($html);
+ $audio = $dom->getElementsByTagName('audio')->item(0);
+
+ $this->assertSame('p', $audio->parentNode->nodeName);
+ $this->assertSame(3, $audio->childNodes->length);
+ }
}