Commit 60345ee0 authored by Robert Knight's avatar Robert Knight

Only load URL polyfill if needed

The URL polyfill is only required if window.URL lacks
a constructor.

'js-polyfills/url' does have its own feature detection but
relies on 'URL' being available at 'this.URL' which works
when loaded independently but not when included as a CommonJS
dependency.

Adding our own feature test here should make it easier to
avoid loading the polyfill entirely in future on browsers
that support the URL constructor.
parent 928906ee
......@@ -2,9 +2,13 @@
require('core-js/es6/promise');
require('core-js/fn/object/assign');
// URL constructor, required by IE 10+,
// Microsoft Edge.
window.URL = require('js-polyfills/url').URL;
// URL constructor, required by IE 10/11,
// early versions of Microsoft Edge.
try {
new window.URL('https://hypothes.is');
} catch (err) {
window.URL = require('js-polyfills/url').URL;
}
// document.evaluate() implementation,
// required by IE 10, 11
......
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