Zoom only allowed in HTML #958

cfergus opened this Issue Dec 11, 2012 · 3 comments

2 participants


The zoom functionality of D3 fails when the root document is an SVG document.
Most examples are embedded within HTML, but is this a requisite of D3?

Suggest either allowing zoom in svg documents, or adding documentation that zoom can only be used in html embedded SVG.

This code tries to reference HTML elements, which causes the failure.

D3 member

Ironically, that code is only there to fix a browser bug where scrolling events are interpreted inconsistently, and the only way to observe them accurately is to dispatch them to a scrollable context and measure how much the context scrolls. Fix one thing, and break another?

But in general, I would say that D3 is only intended to work in an HTML document with embedded SVG. Trying to put D3 inside an SVG document directly is quite rare, so you're treading outside the area of normal development.


I usually tread in lands not-normal.
Totally understandable. Shall I look for a suitable place in the documentation to make mention of this characteristic, or shall I be considered an outlier?
(also, I will take this opportunity to declare D3 as brilliant)

D3 member

Seems like an outlier to me, but maybe not. :) You're here, after all! Feel free to edit the wiki and close this bug.

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