Skip to content

Commit

Permalink
Fix tree-shakability
Browse files Browse the repository at this point in the history
  • Loading branch information
hbirler committed Jul 8, 2021
1 parent 2647bfb commit 2cddb12
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/runtime/internal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ export function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
}

const relative_to_absolute = (function() {
const anchor = document.createElement('a');
return function(url) {
anchor.href = url;
return anchor.href;
};
})();
const relative_to_absolute : ((url: string) => string) & {anchor?: HTMLAnchorElement} = (url: string) => {
if (relative_to_absolute.anchor === undefined) {
relative_to_absolute.anchor = document.createElement('a');
}
relative_to_absolute.anchor.href = url;
return relative_to_absolute.anchor.href;
}

export function src_url_equal(element_src, url) {
return element_src === relative_to_absolute(url);
Expand Down

0 comments on commit 2cddb12

Please sign in to comment.