Skip to content

Commit

Permalink
golf: use doc.head & doc.querySelector;
Browse files Browse the repository at this point in the history
- 764 gz / 620 br
  • Loading branch information
lukeed committed Dec 11, 2018
1 parent 34e9718 commit 53b7d15
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/prefetch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ function linkPrefetchStrategy(url) {
link.onload = resolve;
link.onerror = reject;

const parentElement =
document.getElementsByTagName(`head`)[0] ||
document.getElementsByName(`script`)[0].parentNode;
parentElement.appendChild(link);
(document.head || document.querySelector(`script`.parentNode)).appendChild(link);
});
};

Expand Down

0 comments on commit 53b7d15

Please sign in to comment.