From 68580b56642235ea0d207998ef854e9ed9067ebc Mon Sep 17 00:00:00 2001 From: Philip Rogers Date: Sun, 29 Nov 2015 17:59:28 -0800 Subject: [PATCH] Fix icons in Safari due to a redefinition of the xmlns attribute --- editor/svgicons/jquery.svgicons.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/editor/svgicons/jquery.svgicons.js b/editor/svgicons/jquery.svgicons.js index a6e3e7b9..5a51e46d 100644 --- a/editor/svgicons/jquery.svgicons.js +++ b/editor/svgicons/jquery.svgicons.js @@ -290,7 +290,9 @@ $(function() { holder = $('#' + id); var svg = elem.getElementsByTagNameNS(svgns, 'svg')[0]; var svgroot = document.createElementNS(svgns, "svg"); - svgroot.setAttributeNS(svgns, 'viewBox', [0,0,icon_w,icon_h].join(' ')); + // Per http://www.w3.org/TR/xml-names11/#defaulting, the namespace for + // attributes should have no value. + svgroot.setAttributeNS(null, 'viewBox', [0,0,icon_w,icon_h].join(' ')); // Make flexible by converting width/height to viewBox var w = svg.getAttribute('width'); @@ -317,9 +319,6 @@ $(function() { svgroot.appendChild(svg); var icon; if(toImage) { - // Without cloning, Safari will crash - // With cloning, causes issue in Opera/Win/Non-EN - var svgcontent = isOpera?svgroot:svgroot.cloneNode(true); temp_holder.empty().append(svgroot); var str = data_pre + encode64(unescape(encodeURIComponent(new XMLSerializer().serializeToString(svgroot)))); icon = $(new Image())