Skip to content

Commit

Permalink
Merge pull request #277 from ghiscoding/bugfix/replace-with-exists
Browse files Browse the repository at this point in the history
fix: cross platform compatibility, make sure `replaceWith()` exists before using it
  • Loading branch information
uvarov-frontend authored Aug 2, 2024
2 parents 28fff2a + 19bbeba commit f95e521
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package/src/scripts/destroy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const destroy = (self: VanillaCalendar) => {

if (self.input) {
self.HTMLElement?.parentElement?.removeChild(self.HTMLElement);
self.HTMLInputElement?.replaceWith(self.HTMLOriginalElement);
self.HTMLInputElement?.replaceWith?.(self.HTMLOriginalElement);
self.HTMLInputElement = undefined;
} else {
self.HTMLElement?.replaceWith(self.HTMLOriginalElement);
self.HTMLElement?.replaceWith?.(self.HTMLOriginalElement);
}

self.HTMLElement = self.HTMLOriginalElement;
Expand Down

0 comments on commit f95e521

Please sign in to comment.