Skip to content

Commit

Permalink
refactor: remove optional chaining from the codebase
Browse files Browse the repository at this point in the history
We are removing the optional chaining because one of our users is having issues with an old babel
version that doesn't work with optional chaining.

fix #720
  • Loading branch information
100terres committed Dec 6, 2023
1 parent ad24eda commit cf27ad3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/view/window/get-window-from-el.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
export default (el?: Element | null): typeof window =>
el?.ownerDocument?.defaultView || window;
export default (el?: Element | null): typeof window => {
if (el && el.ownerDocument && el.ownerDocument.defaultView) {
return el.ownerDocument.defaultView;
}

return window;
};

0 comments on commit cf27ad3

Please sign in to comment.