Skip to content

Commit

Permalink
Merge pull request #710 from vimeo/destroy-defensive
Browse files Browse the repository at this point in the history
Be defensive when calling .destroy
  • Loading branch information
rkrishnan8594 committed Apr 19, 2021
2 parents 78e344c + 7babed3 commit 989954e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions dist/player.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ var Player = /*#__PURE__*/function () {
if (_this5.element && _this5.element.nodeName === 'IFRAME' && _this5.element.parentNode) {
// If we've added an additional wrapper div, remove that from the DOM.
// If not, just remove the iframe element.
if (_this5._originalElement !== _this5.element.parentNode && _this5.element.parentNode.parentNode) {
if (_this5.element.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== _this5.element.parentNode) {
_this5.element.parentNode.parentNode.removeChild(_this5.element.parentNode);
} else {
_this5.element.parentNode.removeChild(_this5.element);
Expand All @@ -1745,7 +1745,7 @@ var Player = /*#__PURE__*/function () {
if (iframe && iframe.parentNode) {
// If we've added an additional wrapper div, remove that from the DOM.
// If not, just remove the iframe element.
if (_this5._originalElement !== iframe.parentNode && iframe.parentNode.parentNode) {
if (iframe.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== iframe.parentNode) {
iframe.parentNode.parentNode.removeChild(iframe.parentNode);
} else {
iframe.parentNode.removeChild(iframe);
Expand Down
4 changes: 2 additions & 2 deletions dist/player.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/player.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 989954e

Please sign in to comment.