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

[Bug]: The <use> element support #907

Closed
1 task done
pavlogavryliuk opened this issue May 31, 2022 · 1 comment
Closed
1 task done

[Bug]: The <use> element support #907

pavlogavryliuk opened this issue May 31, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@pavlogavryliuk
Copy link

Preflight Checklist

  • I have searched the issue tracker for a bug report that matches the one I want to file, without success.

What package is this bug report for?

rrweb-snapshot

Expected Behavior

The element takes nodes from within the SVG document, and duplicates them somewhere else.

Example:

<svg viewBox="0 0 30 10" xmlns="http://www.w3.org/2000/svg">
  <circle id="myCircle" cx="5" cy="5" r="4" stroke="blue"/>
  <use href="#myCircle" x="10" fill="blue"/>
  <use href="#myCircle" x="20" fill="white" stroke="red"/>
</svg>

href - should not change to absolute path in this case.

Actual Behavior

RRWeb transform this href attribute to absolute path:

 // relative path in attribute
  if (name === 'src' || (name === 'href' && value)) {
    return absoluteToDoc(doc, value);
  }

All elements with is broken in replayer:

<use href="https://cas2.pipedrive.com/pipeline/1/user/everyone#icon-sm-cross" xlink:href="#icon-sm-cross"></use>

Testcase Gist URL

No response

Additional Information

I've add this changes localy to fix this.

// element should ignore href transform
if (tagName === 'use') {
  const element = n as HTMLImageElement;
  const href = element.getAttribute('href');
  if (href) {
    attributes.href = href;
  }
}
@pavlogavryliuk pavlogavryliuk added the bug Something isn't working label May 31, 2022
@lele0108
Copy link
Contributor

lele0108 commented Jul 15, 2022

@Yuyz0112 @Juice10 @pavlogavryliuk I have fixed this issue in #938

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants