4

I have my JS code in which I use Snap SVG. At some point I use

element.attr({mask:maskelement});

In that snippet, element and maskelement are two elements inside my svg.

Now I want to remove the mask. What would be the correct code that achieves this?

Dennis
  • 1,061
  • 10
  • 21

2 Answers2

1

I found an answer here, although I feel it's not the best answer.

Basically, you set the mask's display property to none with the following code

maskelement.attr("display", "none");

Although the SVG looks like there's no more mask, it doesn't truly remove the mask. I think there's a better answer available.

mjkaufer
  • 4,047
  • 5
  • 27
  • 55
  • 1
    Still I thank you for that answer, though I will leave this question unanswered if that is alright with you. Maybe someone will have "the way-to-go". =) – Dennis Jul 16 '15 at 16:50
0

I had a similar problem. For some reason,

element.attr('mask', null');

does not work, so to make it work, I had to do:

element.node.removeAttribute('mask');
vusiliyK
  • 33
  • 6