mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Fix link widget to work within SVG elements
This commit is contained in:
parent
90469679a5
commit
e71a27ac2d
@ -60,7 +60,8 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
|||||||
tag = "a";
|
tag = "a";
|
||||||
}
|
}
|
||||||
// Create our element
|
// Create our element
|
||||||
var domNode = this.document.createElement(tag);
|
var namespace = this.getVariable("namespace",{defaultValue: "http://www.w3.org/1999/xhtml"}),
|
||||||
|
domNode = this.document.createElementNS(namespace,tag);
|
||||||
// Assign classes
|
// Assign classes
|
||||||
var classes = [];
|
var classes = [];
|
||||||
if(this.overrideClasses === undefined) {
|
if(this.overrideClasses === undefined) {
|
||||||
@ -102,7 +103,8 @@ LinkWidget.prototype.renderLink = function(parent,nextSibling) {
|
|||||||
// Override with the value of tv-get-export-link if defined
|
// Override with the value of tv-get-export-link if defined
|
||||||
wikiLinkText = this.getVariable("tv-get-export-link",{params: [{name: "to",value: this.to}],defaultValue: wikiLinkText});
|
wikiLinkText = this.getVariable("tv-get-export-link",{params: [{name: "to",value: this.to}],defaultValue: wikiLinkText});
|
||||||
if(tag === "a") {
|
if(tag === "a") {
|
||||||
domNode.setAttribute("href",wikiLinkText);
|
var namespaceHref = (namespace === "http://www.w3.org/2000/svg") ? "http://www.w3.org/1999/xlink" : undefined;
|
||||||
|
domNode.setAttributeNS(namespaceHref,"href",wikiLinkText);
|
||||||
}
|
}
|
||||||
// Set the tabindex
|
// Set the tabindex
|
||||||
if(this.tabIndex) {
|
if(this.tabIndex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user