function svgToDataUrl(svg) {
    // Webkit and not chrome
    const userAgent = window.navigator.userAgent;
    const isWebKitButNotChrome = (
        userAgent.indexOf('WebKit') > -1 &&
        userAgent.indexOf('Chrome') < 0
    );

    try {
        // Safari requires data URI since it doesn't allow navigation to blob
        // URLs.
        // foreignObjects dont work well in Blobs in Chrome (#14780).
        if (!isWebKitButNotChrome && svg.indexOf('<foreignObject') === -1) {
            return domurl.createObjectURL(new window.Blob([svg], {
                type: 'image/svg+xml;charset-utf-16'
            }));
        }
    } catch (e) {
    }

    // safari, firefox, or svgs with foreignObect returns this
    return 'data:image/svg+xml;charset=UTF-8,' + encodeURIComponent(svg);
}
/**
 * Get blob URL from SVG code. Falls back to normal data URI for Safari
 */
Get blob URL from SVG code. Falls back to normal data URI for Safari
Get blob URL from SVG code . Falls back to normal data URI for Safari
function svgToDataUrl(svg) {
    const userAgent = window.navigator.userAgent;
    const isWebKitButNotChrome = (
        userAgent.indexOf('WebKit') > -1 &&
        userAgent.indexOf('Chrome') < 0
    );
    try {
        if (!isWebKitButNotChrome && svg.indexOf('<foreignObject') === -1) {
            return domurl.createObjectURL(new window.Blob([svg], {
                type: 'image/svg+xml;charset-utf-16'
            }));
        }
    } catch (e) {
    }
    return 'data:image/svg+xml;charset=UTF-8,' + encodeURIComponent(svg);
}
function svgToDataUrl ( svg ) { const userAgent = window . navigator . userAgent ; const isWebKitButNotChrome = ( userAgent . indexOf ( 'WebKit' ) > - 1 && userAgent . indexOf ( 'Chrome' ) < 0 ) ; try { if ( ! isWebKitButNotChrome && svg . indexOf ( '<foreignObject' ) === - 1 ) { return domurl . createObjectURL ( new window . Blob ( [ svg ] , { type : 'image/svg+xml;charset-utf-16' } ) ) ; } } catch ( e ) { } return 'data:image/svg+xml;charset=UTF-8,' + encodeURIComponent ( svg ) ; }
Get blob URL from SVG code.
Get blob URL from SVG code .
// Webkit and not chrome // Safari requires data URI since it doesn't allow navigation to blob // URLs. // foreignObjects dont work well in Blobs in Chrome (#14780). // safari, firefox, or svgs with foreignObect returns this