Merge pull request #470 from CyberDomovoy/html5-treebuilder-namespace-error

Detect the namespace uri from token name
This commit is contained in:
friendica 2012-09-14 20:21:29 -07:00
commit e581c34760

View file

@ -158,6 +158,8 @@ class HTML5_TreeBuilder {
if ($this->ignore_lf_token) $this->ignore_lf_token--; if ($this->ignore_lf_token) $this->ignore_lf_token--;
$this->ignored = false; $this->ignored = false;
$token['name'] = str_replace(':', '-', $token['name']);
// indenting is a little wonky, this can be changed later on // indenting is a little wonky, this can be changed later on
switch ($mode) { switch ($mode) {
@ -1429,7 +1431,7 @@ class HTML5_TreeBuilder {
case 'tbody': case 'td': case 'tfoot': case 'th': case 'thead': case 'tr': case 'tbody': case 'td': case 'tfoot': case 'th': case 'thead': case 'tr':
// parse error // parse error
break; break;
/* A start tag token not covered by the previous entries */ /* A start tag token not covered by the previous entries */
default: default:
/* Reconstruct the active formatting elements, if any. */ /* Reconstruct the active formatting elements, if any. */
@ -3038,7 +3040,7 @@ class HTML5_TreeBuilder {
private function insertElement($token, $append = true) { private function insertElement($token, $append = true) {
$el = $this->dom->createElementNS(self::NS_HTML, $token['name']); $el = $this->dom->createElementNS(self::NS_HTML, $token['name']);
if (!empty($token['attr'])) { if (!empty($token['attr'])) {
foreach($token['attr'] as $attr) { foreach($token['attr'] as $attr) {