We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

ابحث في الدعم

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Extracted svg figure is different with which show in orginal html file

  • 2 (ردّان اثنان)
  • 1 has this problem
  • 3 views
  • آخر ردّ كتبه xiestcn

more options

I have a local HTML file which executes some js functions to draw svg figure. The browser rendered the HTML well, and then I extracted the svg conent from console using console.log(document.getElementsByTagName('svg')[0].outerHTML) and save as "t.svg". I found there was a slight difference between figure in "t.svg" and the orignal HMTL rendered by browser. But when I redid these in chrome and ms edge, the "t.svg" and the HTML were exactly same.

I have a local HTML file which executes some js functions to draw svg figure. The browser rendered the HTML well, and then I extracted the svg conent from console using console.log(document.getElementsByTagName('svg')[0].outerHTML) and save as "t.svg". I found there was a slight difference between figure in "t.svg" and the orignal HMTL rendered by browser. But when I redid these in chrome and ms edge, the "t.svg" and the HTML were exactly same.
Attached screenshots

All Replies (2)

more options

The second screenshot shows a bit zoomed with only the text being zoomed and not their containers causing content to overlap.

You may have accidentally zoomed webpage(s). Reset the page zoom on pages that cause problems.

  • View -> Zoom -> Reset (Ctrl+0/Command+0 (zero))

Also make sure you aren't using "Zoom text only"

  • Settings -> General -> Language and Appearance -> Zoom
more options

cor-el said

Thanks for your reply!

The problem is not caused by Zoom setting. It's probably caused by Font family. The text's font family set in svg is not exists in my Win10 laptop. As I extracted the svg from console, the browser may compute the text box width use "Times new roman"(default font family set in firefox), and the rendered svg displayed the text in other Font family which is wider than "Times new roman" in same font size. I fixed the problem by changing the font family to "Microsoft YaHei".

But the problem is still there with default font family setting. Could Firefox do this by default without modify the settings (or may be in future version?), as the HTML can be rendered correctly by default.