# use

The use element takes nodes from within the SVG document, and duplicates them somewhere else. The effect is the same as if the nodes were deeply cloned, and pasted where the use element is.

Usually, this element is create with:

const use = parentElement.add('use').href('#reference')

It's possible create as a disconnected element with gySVG('use') and attach it to the SVG document with .attachTo().

More info: mdn (opens new window) | w3c (opens new window)

# .href()

use.href( ref )

Set the URL to an element/fragment that needs to be duplicated. Usually it is a reference to an id value as #idetificator.

  • argument: {string} ref Referente the element to be duplicated

  • returns: {gySVGObject} The original object

const href = element.href();

Get the href current value.

  • returns: {string} Reference to the duplicated element

# .x()

use.x( _ )

Set the x coordinate of the use element.

  • argument: {} _

  • returns: {gySVGObject} The original object

const x = element.x();

Get the x current value.

  • returns: {}

# .y()

use.y( _ )

Set the y coordinate of the use element.

  • argument: {} _

  • returns: {gySVGObject} The original object

const y = element.y();

Get the y current value.

  • returns: {}

# .width()

use.width( _ )

Set the width of the use element.

  • argument: {} _

  • returns: {gySVGObject} The original object

const width = element.width();

Get the width current value.

  • returns: {}

# .height()

use.height( _ )

Set the height of the use element.

  • argument: {} _

  • returns: {gySVGObject} The original object

const height = element.height();

Get the height current value.