Commit 3cb74643 authored by Robert Knight's avatar Robert Knight

Fix browser support check failure if boot script loaded before body

Fix a false negative in the test for whether the current browser is
supported if the Hypothesis boot script is included in the `<head>` of
the page (before the `<body>`). In this case `document.body` is `null`.
parent 9906ff6f
...@@ -17,7 +17,7 @@ export function isBrowserSupported() { ...@@ -17,7 +17,7 @@ export function isBrowserSupported() {
// DOM API checks for frequently-used APIs. // DOM API checks for frequently-used APIs.
() => new URL(document.location.href), // URL constructor. () => new URL(document.location.href), // URL constructor.
() => new Request('https://hypothes.is'), // Part of the `fetch` API. () => new Request('https://hypothes.is'), // Part of the `fetch` API.
() => document.body.prepend.name, // Element.prepend() method. () => Element.prototype.prepend.name,
// DOM API checks for less frequently-used APIs. // DOM API checks for less frequently-used APIs.
// These are less likely to have been polyfilled by the host page. // These are less likely to have been polyfilled by the host page.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment