example/js/svg.js
function(element) {
    // use given mask or create a new one
    this.masker = element instanceof SVG.Mask ? element : this.parent().mask().add(element)

    // store reverence on self in mask
    this.masker.targets.push(this)

    // apply mask
    return this.attr('mask', 'url("#' + this.masker.attr('id') + '")')
  }
function(element) {
    // use given mask or create a new one
    this.masker = element instanceof SVG.Mask ? element : this.parent().mask().add(element)

    // store reverence on self in mask
    this.masker.targets.push(this)

    // apply mask
    return this.attr('mask', 'url("#' + this.masker.attr('id') + '")')
  }
function ( element ) { // use given mask or create a new one this . masker = element instanceof SVG . Mask ? element : this . parent ( ) . mask ( ) . add ( element ) // store reverence on self in mask this . masker . targets . push ( this ) // apply mask return this . attr ( 'mask' , 'url("#' + this . masker . attr ( 'id' ) + '")' ) }
Distribute mask to svg element
Distribute mask to svg element