diff --git a/thirdparty/html5lib-php/library/HTML5/TreeBuilder.php b/thirdparty/html5lib-php/library/HTML5/TreeBuilder.php
index 2f5244f..8543df5 100644
--- a/thirdparty/html5lib-php/library/HTML5/TreeBuilder.php
+++ b/thirdparty/html5lib-php/library/HTML5/TreeBuilder.php
@@ -1354,11 +1354,23 @@ public function emitToken($token, $mode = null) {
$this->insertCDATAElement($token);
break;
- case 'noembed': case 'noscript':
- // XSCRIPT: should check scripting flag
+ case 'noembed':
$this->insertCDATAElement($token);
break;
+ case 'noscript':
+ // XSCRIPT: should check scripting flag
+
+ if($this->elementInScope('noscript')) {
+ $this->emitToken(array(
+ 'name' => 'noscript',
+ 'type' => HTML5_Tokenizer::ENDTAG
+ ));
+ }
+ $this->reconstructActiveFormattingElements();
+ $this->insertElement($token);
+ break;
+
/* A start tag whose tag name is "select" */
case 'select':
/* Reconstruct the active formatting elements, if any. */
@@ -3837,4 +3849,3 @@ public function save() {
}
}
}
-