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

repeated xlink:href on 'use' elements #12

Open
tiarno opened this issue Feb 10, 2015 · 7 comments
Open

repeated xlink:href on 'use' elements #12

tiarno opened this issue Feb 10, 2015 · 7 comments

Comments

@tiarno
Copy link
Contributor

tiarno commented Feb 10, 2015

The SVG result contains 'use' elements that have duplicate xlink:href elements. That is, using two terminal windows (this is win7)

  1. phantomjs.exe main.js
  2. wget http://localhost:16000/?q=x+e -O test.svg

The resulting SVG has 'use' elements like this:

<use xlink:href="#MJMATHI-78" x="0" y="0" xlink:href="#MJMATHI-78">

What I did to fix it was to replace line 73 in engine.js, which inserts the attribute, with this conditional block:

  if (uses[k]["href"] === undefined) {
      uses[k].setAttribute("xlink:href", id);
  }
@tiarno tiarno changed the title repeated xlink:href on 'u' elements repeated xlink:href on 'use' elements Feb 10, 2015
@agrbin
Copy link
Owner

agrbin commented Feb 14, 2015

Hello tiarno, thanks for the heads up.
Would you mind sending me a pull request for this change, so I can just approve it?

@tiarno
Copy link
Contributor Author

tiarno commented Feb 16, 2015

hi agrbin, I will send a pull request soon; my fork has some issues right now but I'll be back in touch soon, and it will have just the one fix. thx.

physikerwelt pushed a commit to physikerwelt/mathoid-server that referenced this issue Mar 6, 2015
@stroobandt
Copy link
Contributor

This "fix" has caused a major regression and rendered svgtex completely useless on GNU/Linux (Xubuntu LTS 14.04). On all my browsers (Firefox, Chrome, etc.), I now only see one or more horizontal lines instead of any formula. Reverting baacbe9 fixes the problem.

@tiarno
Copy link
Contributor Author

tiarno commented May 15, 2015

Sorry for the trouble and glad you could revert. I will follow up after some research. I was validating the elements according to http://www.w3.org/TR/SVG11/struct.html#UseElementHrefAttribute which worked on my windows box. It doesn't make sense to me for an xlink to have multiple hrefs; once I have a fix that works for linux as well I'll repost for consideration.

@tiarno
Copy link
Contributor Author

tiarno commented May 15, 2015

As far as I can tell, it is an error to have multiple hrefs.
http://www.w3.org/TR/xlink11/
With @serge-stroobandt's results, my guess is that the code I submitted creates another error while fixing the multiple href problem.

@stroobandt
Copy link
Contributor

@tiarno You are welcome. I have no problem at all with sticking to standards, but it has to work. Unfortunately, I am not an expert at all on SVG nor xlink. So, I am afraid I cannot really tell you what is going wrong, apart from not seeing any formulas at all in my browsers, only a few horizontal lines despite a succesful svgtex run. Do you have capability for testing on Linux?

@tiarno
Copy link
Contributor Author

tiarno commented May 16, 2015

@serge-stroobandt : no argument here--working is the first thing the code has to do regardless of validation. I cannot test on Linux, but I can on Mac and Windows. I will play around with it and make sure it will work on all platforms before another pull request. Sorry for the trouble.

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

3 participants