Fix for destroy
This commit is contained in:
parent
4879bea4a0
commit
743c84188e
2
dist/plyr.js
vendored
2
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.js.map
vendored
2
dist/plyr.js.map
vendored
File diff suppressed because one or more lines are too long
@ -922,16 +922,23 @@ class Plyr {
|
|||||||
|
|
||||||
// If it's a soft destroy, make minimal changes
|
// If it's a soft destroy, make minimal changes
|
||||||
if (soft) {
|
if (soft) {
|
||||||
utils.removeElement(this.elements.captions);
|
if (Object.keys(this.elements).length) {
|
||||||
|
// Remove buttons
|
||||||
|
if (this.elements.buttons && this.elements.buttons.play) {
|
||||||
Array.from(this.elements.buttons.play).forEach(button => utils.removeElement(button));
|
Array.from(this.elements.buttons.play).forEach(button => utils.removeElement(button));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove others
|
||||||
|
utils.removeElement(this.elements.captions);
|
||||||
utils.removeElement(this.elements.controls);
|
utils.removeElement(this.elements.controls);
|
||||||
utils.removeElement(this.elements.wrapper);
|
utils.removeElement(this.elements.wrapper);
|
||||||
|
|
||||||
// Clear for GC
|
// Clear for GC
|
||||||
|
this.elements.buttons.play = null;
|
||||||
this.elements.captions = null;
|
this.elements.captions = null;
|
||||||
this.elements.controls = null;
|
this.elements.controls = null;
|
||||||
this.elements.buttons.play = null;
|
|
||||||
this.elements.wrapper = null;
|
this.elements.wrapper = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Callback
|
// Callback
|
||||||
if (utils.is.function(callback)) {
|
if (utils.is.function(callback)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user