Forráskód Böngészése

Fix 'TypeError' on destroy

Prevents "TypeError" (cannot read property 'remove' of null) when $("myElem").vegas('destroy') is called and
'timer' or 'overlay' settings are null or false.
Fausto Bencosme 10 éve
szülő
commit
7af3da8116
1 módosított fájl, 6 hozzáadás és 3 törlés
  1. 6 3
      src/vegas.js

+ 6 - 3
src/vegas.js

@@ -614,9 +614,12 @@
             this.$elmt.find('> .vegas-slide').remove();
             this.$elmt.find('> .vegas-slide').remove();
             this.$elmt.find('> .vegas-wrapper').clone(true).children().appendTo(this.$elmt);
             this.$elmt.find('> .vegas-wrapper').clone(true).children().appendTo(this.$elmt);
             this.$elmt.find('> .vegas-wrapper').remove();
             this.$elmt.find('> .vegas-wrapper').remove();
-            this.$timer.remove();
-            this.$overlay.remove();
-
+            if (this.settings.timer) {
+              this.$timer.remove();    
+            }
+            if (this.settings.overlay) {
+              this.$overlay.remove();    
+            }
             this.elmt._vegas = null;
             this.elmt._vegas = null;
         }
         }
     };
     };