if ($this->ignore_lf_token) $this->ignore_lf_token--;
$this->ignored = false;
+
+ $token['name'] = str_replace(':', '-', $token['name']);
// indenting is a little wonky, this can be changed later on
switch ($mode) {
case 'tbody': case 'td': case 'tfoot': case 'th': case 'thead': case 'tr':
// parse error
break;
-
+
/* A start tag token not covered by the previous entries */
default:
/* Reconstruct the active formatting elements, if any. */
}
private function insertElement($token, $append = true) {
- $sep_pos = strpos($token['name'],':');
- $ns_uri = self::NS_HTML;
- if($sep_pos !== FALSE) {
- // This tag has a namespace
- $ns = substr($token['name'], 0, $sep_pos);
- switch($ns) {
- case 'g':
- $ns_uri = 'http://base.google.com/ns/1.0';
- break;
- default:
- logger("HTML5/TreeBuilder.php: Unknown namespace '". $ns ."', tag = ". $token['name'], LOGGER_DEBUG);
- break;
- }
- }
- $el = $this->dom->createElementNS($ns_uri, $token['name']);
+ $el = $this->dom->createElementNS(self::NS_HTML, $token['name']);
+ if ($el == false) {
+ logger('insertElement(): ignoring invalid token='.$token['name']);
+ return false;
+ }
if (!empty($token['attr'])) {
foreach($token['attr'] as $attr) {