-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Support Fabric in XML documents. #5530
Comments
editor.zip In particular, it renders differently in Mozilla Firefox and Google Chrome: in Firefox there is a red dot above the canvas element. In Chrome, there isn't. That's more likely to be a browser behavior, though, not a Fabric bug. |
i ll try the editor.zip, understand the use case and probably merge. |
This breaks IE10 and IE9: both do not support HTMLDocument. |
ie9 is no more supported since 2.0 |
Fabric.js assumes that it runs inside a HTML document. Which is usually not a bad assumption, but it does mean if I try to load Fabric in a XML document, it just breaks all over the place. In particular, when referring to properties of element.style, it throws exceptions because element is an instance of Element, not HTMLElement. The latter has the style property; the former does not.
Fortunately the fix is simple: in HEADER.js, I use
fabric.document = document.implementation.createHTMLDocument("");
to make this work (in the case where document isn't a HTMLDocument). I will provide a pull request momentarily.I can provide a testcase upon request, written in SVG and using the
<foreignObject>
element. (I know, I know, why use FabricJS and Canvas if I have SVG? Well, I have my reasons - specifically, being able to capture a video stream in the browser from the canvas.) In general, though, I think the pull request I will generate will work with any XML document.The text was updated successfully, but these errors were encountered: