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

Does not find first g-element, only works with id="viewport" attribute #21

Open
GoogleCodeExporter opened this issue Mar 16, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Using the sample lion.svg, remove the 'id="viewport"' attribute. 

What is the expected output? What do you see instead?
When the element with id="viewport" is not found, the library should find the 
first g-element, and the functionality should still be available. But zooming 
and panning is not available.

What version of the product are you using? On what operating system?
Version 1.2.2 in Firefox 15.0.1 on Mac OS 10.6.8.

Please provide any additional information below.
Resolved by modifying function getRoot():
Original:
    var r = root.getElementById("viewport") ? root.getElementById("viewport") : root.documentElement, t = r;
Fixed:
    var r = root.getElementById("viewport");
    if (!r) r = root.documentElement.getElementsByTagName ('g')[0];
    var t = r;

Original issue reported on code.google.com by [email protected] on 2 Oct 2012 at 4:56

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

No branches or pull requests

1 participant