Tom Klino
Tom Klino

Reputation: 2514

is raphaeljs remove function causes the element to be falsey?

I have a check to see if the element has been drawn already by doing

if(element)

so I can choose whether to update the element or to draw it a new.

this works before the element is drawn, but not after element.remove()

even though if I use

alert(element);

I'm seeing undefined, which should be falsey.

Can anyone explain this?

Upvotes: 0

Views: 39

Answers (1)

sanchez
sanchez

Reputation: 4530

This should work for both cases, if element is falsy or if it is a string 'undefined' (as @Gwyn Howell mentioned in the comment):

if( !!element && element!=='undefined' )

Upvotes: 2

Related Questions