From 710759daed9f73eec9822009cbd29382c17f0046 Mon Sep 17 00:00:00 2001 From: buggyj Date: Sat, 30 Aug 2014 17:25:04 +0200 Subject: [PATCH 1/2] added support for xlink: attribute prefix --- core/modules/widgets/widget.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 9424dd6d8..6f20616df 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -263,9 +263,15 @@ Widget.prototype.assignAttributes = function(domNode,options) { v = undefined; } if(v !== undefined) { + var b = a.split(":"); // Setting certain attributes can cause a DOM error (eg xmlns on the svg element) try { - domNode.setAttributeNS(null,a,v); + if (b.length == 2 && b[0] == "xlink"){ + domNode.setAttributeNS("http://www.w3.org/1999/xlink",b[1],v); + } + else { + domNode.setAttributeNS(null,a,v); + } } catch(e) { } } From 05dfa1e1e329c2503ac6d5ddfaccdb4ab5ba8759 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Sat, 30 Aug 2014 23:05:04 +0100 Subject: [PATCH 2/2] Coding style tweak --- core/modules/widgets/widget.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 4ddf69c3b..144f12fa2 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -268,8 +268,7 @@ Widget.prototype.assignAttributes = function(domNode,options) { try { if (b.length == 2 && b[0] == "xlink"){ domNode.setAttributeNS("http://www.w3.org/1999/xlink",b[1],v); - } - else { + } else { domNode.setAttributeNS(null,a,v); } } catch(e) {