link.source()

Return a shallow copy of the source property of the link.

If the beginning of the link is connected to an element, an object in the format { id: elementID } is returned. If the beginning of the link is specified as a point instead (the link is pinned to the paper at that point), an object in the format { x: sourceX, y: sourceY } is returned. Furthermore, any additional arguments of the source are returned alongside those properties.

If you need to be sure that a Cell is returned (and not a Point), use the link.getSourceCell function instead. If you need an Element, use the link.getSourceElement function.

link.source(source [, opt])

Set the source of the link.

If the link is to be connected to an element, send an object in the format { id: element.id } (or a joint.dia.Element object). If the link is to be pinned to the paper, send an object in the format { x: sourceX, y: sourceY } (or a g.Point object).

link.source(rect);
link.source({ id: rect.id });

link.source(new g.Point(100, 100));
link.source({ x: 100, y: 100 });

Additional options may by provided to further specify the behavior of link at the source:

link.source(rect, {
    selector: 'body',
    anchor: {
        name: 'bottomLeft',
        args: {
            dx: 20,
            dy: -10
        }
    }
});

More information can be found in link source documentation.