Diagram.fromDiv()

I just want to make sure that I understand how fromDiv() works and its limitations.

As I understand it, fromDiv() generates a Diagram from the a div holding an html canvas, which will contain the current graphical representation of the originating Diagram. Am I correct in thinking, therefore, that aspects of the originating diagram that are not actively displayed will not be available in the Diagram derived by fromDiv(). I’m thinking of such things as tootips or other parts/adornments which are only shown ephemerally.

The static Diagram.fromDiv function just returns the instance of Diagram that is associated with a particular HTMLDivElement, if any exists.

It is just a property getter – it does not create anything. If you haven’t set the Diagram.div so that a Diagram is hosted by a Div, then there won’t be any Diagram associated with that Div. Note that initializing a Diagram and referring to a Div does that property setting for you:

$(go.Diagram, "myDiagramDiv", ...)

or

$(go.Diagram, document.getElementById(...), ...)

or

new go.Diagram("myDiagramDiv", ...)

or

new go.Diagram(document.getElementById(...), ...)