1. 22 Oct, 2020 4 commits
    • Robert Knight's avatar
      Enable terser workarounds for Safari 10 · bb83c852
      Robert Knight authored
      This fixes an error in production builds of the client in Safari 10:
      
      ```
      SyntaxError: Cannot declare a let variable twice: 't'.
      ```
      
      Fixes #2664
      bb83c852
    • Robert Knight's avatar
      Remove unused iframe attributes · 25d3aa48
      Robert Knight authored
       - Remove `seamless` attribute which has not been supported by major
         browsers for years [1]
       - Remove the `name="hyp_sidebar_frame"` attribute which is not
         referenced anywhere else in the code. I did find a couple of
         references to it in Google, but only in scripts written by Hypothesis
         team members which are not run regularly.
      
      [1] https://caniuse.com/iframe-seamless
      25d3aa48
    • Robert Knight's avatar
      Update Babel compilation targets · f2d50edc
      Robert Knight authored
      Update Babel compilation targets to match the browsers we currently support,
      rather than transpiling everything down to ES5.
      
      This reduces the size of our JS bundles and improves performance by using native
      implementations of ES2015+ language features. It should also avoid
      occassional issues in development caused by interactions of Babel plugins that
      compile native features to older syntax (eg. `transform-async-to-promises`).
      
      The client's boot script has a different configuration than the rest of the
      client because it needs to be able to run in older browsers in order to show a
      warning when the browser is not supported.
      
      The production bundle size changes resulting from this are:
      
      Sidebar bundle: 398 KB => 329 KB
      Annotator bundle: 219 KB => 169 KB
      f2d50edc
    • Robert Knight's avatar
      Fix test failures when arrow functions are not transformed · 8dd7a112
      Robert Knight authored
      Native (non-transpiled) arrow functions cannot be used with the `new` operator.
      This commit fixes a couple of cases where that was happening.
      8dd7a112
  2. 21 Oct, 2020 2 commits
    • Robert Knight's avatar
      Merge Host and Sidebar classes · 11542d1f
      Robert Knight authored
      The `Host` class is never constructed directly and only has one
      subclass, `Sidebar`. There wasn't a clear separation of responsibilities between
      `Host` and `Sidebar`. This commit therefore moves the functionality of `Host` into
      `Sidebar` and merges the tests.
      11542d1f
    • Lyza Danger Gardner's avatar
      Re-implement bucket generation and usage · d2f88164
      Lyza Danger Gardner authored
      Restructure the way that buckets are generated and represented. Simplify
      what `BucketBar` needs to do with the buckets. Fix a bug in which
      anchors can be occasionally included in multiple buckets.
      
      Fixes #397
      Fixes #2618
      d2f88164
  3. 20 Oct, 2020 14 commits
  4. 16 Oct, 2020 9 commits
  5. 15 Oct, 2020 1 commit
    • Robert Knight's avatar
      Remove checks for IE 11 in `TagEditor` component · da788daf
      Robert Knight authored
      `TagEditor` tested if the browser was IE 11 to determine whether to
      check the `inputType` property of `InputEvent`. However it is not only
      IE 11 that did not support this property.
      
      From reading the comments in https://github.com/hypothesis/client/pull/1558 it
      appears that the `inputType` checks was originally added to resolve an
      issue with accepting suggestions by pressing Enter in an earlier version
      of `TagEditor` that used the `<datalist>` element. As far as I can tell
      this is no longer applicable. `<datalist>` was replaced by a custom UI
      and accepting suggestions by pressing Enter works without this logic.
      Therefore this commit removes it entirely.
      da788daf
  6. 14 Oct, 2020 8 commits
    • Robert Knight's avatar
      Fix `Promise.prototype.finally` polyfill loading in older browsers · 77478163
      Robert Knight authored
      The sidebar application failed to load in Safari 10 due to the ES 2018
      polyfill bundle, which contains a polyfill for
      `Promise.prototype.finally`, not being loaded in that browser.
      
      The issue was that 'es2018' was not listed in the polyfill bundles to
      build in `gulpfile.js` or in the list of bundles required by the sidebar
      app in `boot.js`.
      
      This commit fixes these issues and makes the issue less likely to occur
      in future by:
      
       - Removing the need to manually list each polyfill bundle in
         `gulpfile.js`. Instead the `src/shared/polyfills` dir is listed and
         every non-`index.js` file is used as the root of a bundle.
       - Factoring out the polyfills common to the sidebar and annotator app
         into a variable and including "es2018" there
      77478163
    • Robert Knight's avatar
      Remove `Element.closest` polyfill · 0fd302bd
      Robert Knight authored
      Element.closest is natively supported [1] by our minimum browser targets.
      
      [1] https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Browser_compatibility
      0fd302bd
    • Robert Knight's avatar
      Fix `document.evaluate` feature test in Edge Legacy · 2e6b8a6e
      Robert Knight authored
      This API is available in Edge Legacy but with a quirk that arguments
      that are optional in the spec are required in this browser.
      
      This fixes an issue that the client would incorrectly abort startup in
      Edge Legacy with a warning that the browser is unsupported.
      2e6b8a6e
    • Robert Knight's avatar
      Remove `createNodeIterator` polyfill · 7545b9a2
      Robert Knight authored
      This polyfilled the optional-ness of the `filter` and deprecated
      `expandEntityRefrences` arguments of `document.createNodeIterator` in IE
      11, which is no longer supported.
      7545b9a2
    • Robert Knight's avatar
      Remove `document.baseURI` polyfill · 93d916b8
      Robert Knight authored
      This was only needed for IE 11, which is no longer supported.
      93d916b8
    • Robert Knight's avatar
      Remove `custom-event` polyfill · c837812e
      Robert Knight authored
      This was only needed for IE 11, which is no longer supported.
      c837812e
    • Robert Knight's avatar
      Remove `document.evaluate` polyfill · 9588558a
      Robert Knight authored
      This was only needed for IE 11, which is no longer supported.
      9588558a
    • Robert Knight's avatar
      Gracefully abort startup in old browsers · e1f314b3
      Robert Knight authored
      Run a series of feature tests at the very start of the boot process and
      abort with a console warning if they fail.
      
      We display a console warning rather than a louder warning to avoid being
      disruptive on sites maintained by publishers which embed Hypothesis and
      which still want to support older browsers. On those sites the
      Hypothesis annotation feature will simply be missing.
      e1f314b3
  7. 13 Oct, 2020 2 commits