Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svg图标 xlink:href="#icon_app",会自动添加域名,导致回放不显示svg图标 #566

Closed
it-fuhao opened this issue May 26, 2021 · 1 comment

Comments

@it-fuhao
Copy link

rrweb-snapshot.js

function transformAttribute(doc, name, value) {
    if (name === 'src' || ((name === 'href' || name === 'xlink:href') && value)) {
        return absoluteToDoc(doc, value); //  这个方法给svg路径默认添加了域名绝对路径,导致svg无法显示
    }
    else if (name === 'srcset' && value) {
        return getAbsoluteSrcsetString(doc, value);
    }
    else if (name === 'style' && value) {
        return absoluteToStylesheet(value, location.href);
    }
    else {
        return value;
    }
}

能否判断svg标签,直接将value返回

if (name === 'xlink:href') {
    return value;
}
@Yuyz0112
Copy link
Member

引入问题的 PR:rrweb-io/rrweb-snapshot#55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants