Skip to content

Commit

Permalink
[BUG] Fix compatibility issue when WeakRef is not supported (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyril-sf committed Dec 11, 2023
1 parent 543c4ce commit 78c69d0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions addon/utils/ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ function fromWeakRefIfSupported(node) {

/**
*
* @param {null | undefined | WeeakRef | HTMLElement } node
* @param {null | undefined | WeakRef | HTMLElement } node
* @returns
*/
function toWeakRefIfSupported(node) {
if (node === null || node === undefined) {
return null;
}
if (node instanceof WeakRef) {
return node;
}
if (hasWeakRef) {
if(hasWeakRef)

Check failure on line 42 in addon/utils/ref.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `(hasWeakRef)⏎·` with `·(hasWeakRef)`
{
if (node instanceof WeakRef) {

Check warning on line 44 in addon/utils/ref.js

View workflow job for this annotation

GitHub Actions / Lint

'WeakRef' is not defined
return node;
}

return new WeakRef(node);

Check warning on line 48 in addon/utils/ref.js

View workflow job for this annotation

GitHub Actions / Lint

'WeakRef' is not defined
}
return node;
Expand Down

0 comments on commit 78c69d0

Please sign in to comment.