mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-23 15:36:52 +00:00
Fix svg foreignObject that contains DIVs (#6755)
* xmlns attribute defined in element takes precedence * use predefined tagNamespaces variable as default value * change code as suggested by Jeremy
This commit is contained in:
parent
a59ec3ebf7
commit
76bc2f7524
@ -42,16 +42,22 @@ ElementWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
this.tag = "h" + headingLevel;
|
this.tag = "h" + headingLevel;
|
||||||
}
|
}
|
||||||
// Select the namespace for the tag
|
// Select the namespace for the tag
|
||||||
|
var XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
||||||
var tagNamespaces = {
|
var tagNamespaces = {
|
||||||
svg: "http://www.w3.org/2000/svg",
|
svg: "http://www.w3.org/2000/svg",
|
||||||
math: "http://www.w3.org/1998/Math/MathML",
|
math: "http://www.w3.org/1998/Math/MathML",
|
||||||
body: "http://www.w3.org/1999/xhtml"
|
body: XHTML_NAMESPACE
|
||||||
};
|
};
|
||||||
this.namespace = tagNamespaces[this.tag];
|
this.namespace = tagNamespaces[this.tag];
|
||||||
if(this.namespace) {
|
if(this.namespace) {
|
||||||
this.setVariable("namespace",this.namespace);
|
this.setVariable("namespace",this.namespace);
|
||||||
} else {
|
} else {
|
||||||
this.namespace = this.getVariable("namespace",{defaultValue: "http://www.w3.org/1999/xhtml"});
|
if (this.hasAttribute("xmlns")) {
|
||||||
|
this.namespace = this.getAttribute("xmlns");
|
||||||
|
this.setVariable("namespace",this.namespace);
|
||||||
|
} else {
|
||||||
|
this.namespace = this.getVariable("namespace",{defaultValue: XHTML_NAMESPACE});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Invoke the th-rendering-element hook
|
// Invoke the th-rendering-element hook
|
||||||
var parseTreeNodes = $tw.hooks.invokeHook("th-rendering-element",null,this);
|
var parseTreeNodes = $tw.hooks.invokeHook("th-rendering-element",null,this);
|
||||||
|
Loading…
Reference in New Issue
Block a user