1. 05 Oct, 2020 2 commits
    • Robert Knight's avatar
      Simplify annotator plugin initialization · d17e2546
      Robert Knight authored
      Previously plugin initialization happened in several steps:
      
       1. The plugin constructor was called with the root element and config
          options
       2. The plugin's `annotator` property was set to a reference to the
          `Guest` instance for the current document
       3. The plugin's `pluginInit` method was called
      
      There was no real need for this multi-step process. This commit
      simplifies it by removing the `pluginInit` method and passing the guest
      reference as a third argument to the constructor in step 1.
      
      As a result, the `Plugin` base class is no longer needed. Plugins now
      extend the parent `Delegator` class instead.
      d17e2546
    • Eduardo Sanz García's avatar
      edc9713b
  2. 02 Oct, 2020 3 commits
    • Kyle Keating's avatar
      Convert types.coffee to js · 43f23cc5
      Kyle Keating authored
      - Convert types to js
      - Add missing test coverage in types module
      43f23cc5
    • Robert Knight's avatar
      Fix grammatical error in comment · 4033f872
      Robert Knight authored
      Respond to PR feedback by updating comments
      4033f872
    • Robert Knight's avatar
      Simplify XPath generation code · f2b25403
      Robert Knight authored
      For reasons that AFAIK are no longer relevant, there were two
      implementations of XPath generation for use in serializing range
      selectors. Since we're removing jQuery from the Hypothesis client, this
      removes the jQuery implementation and simplifies the remaining DOM-only
      one.
      
       - Remove jQuery XPath generation
      
       - Change the non-jQuery implementation to take DOM Nodes as input
         rather than jQuery collections
      
       - Simplify and add type documentation for the remaining implementation
      
       - Correct the documentation for `xpathFromNode`. The previous comments
         said that it _evaluated_ XPaths but actually it _generates_ them.
      f2b25403
  3. 30 Sep, 2020 1 commit
    • Robert Knight's avatar
      Remove references to obsolete `page.el` property · 2414a08b
      Robert Knight authored
      The `el` property of PDF pages was removed from PDF.js in February 2015
      in eed67ea8bbba61a05877a99dc2f03b5adad5a288 so we can remove this check
      while still supporting older versions of PDF.js that we care about.
      
      Also rewrite an unnecessarily complex loop header. The `pagesCount`
      property cannot be negative, so there is no need to check for this.
      2414a08b
  4. 29 Sep, 2020 12 commits
  5. 28 Sep, 2020 3 commits
  6. 25 Sep, 2020 7 commits
    • Kyle Keating's avatar
      Convert range.coffee to range.js · 9fb4e54d
      Kyle Keating authored
      - Remove xpath.coffee as it is no longer needed
      - Add missing unit tests for range.js module
      9fb4e54d
    • Kyle Keating's avatar
      Rename range-js to xpath-evaluate · b00d243f
      Kyle Keating authored
      b00d243f
    • Lyza Danger Gardner's avatar
      Debounce MutationObserver callback for performance improvements · 14d5b72f
      Lyza Danger Gardner authored
      Debounce the `_update` method to improve browser performance in
      responding to DOM mutations (PDF annotation highlights re-draw
      more smoothly).
      14d5b72f
    • Robert Knight's avatar
      Remove rAF from highlight drawing and make synchronous · 03f1821b
      Robert Knight authored
      Bug #2502 arises from an issue with the asynchronous code in guest
      that relies on `requestAnimationFrame` before drawing highlights for
      a particular anchor range.
      
      When the DOM is being mutated in multiple ways, the range present in
      the synchronous `highlight` code can be different from the range once
      the `requestAnimationFrame` — i.e. it could have changed again since
      the range was sniffed in the `highlight` method.
      
      The call to `range.normalize` in the rAF callback in these cases might
      be operating on a range that is effectively invalid per the `normalize`
      method's (unwritten) expectations. That in turn throws and then causes
      a failure of highlight drawing until the document is reloaded.
      
      Some brittleness in `range` methods and other dependencies makes this
      challenging to fix easily in an asynchronous manner. It's unclear
      exactly why rAF asynchronicity was added
      (see ca87c1c5 ).
      
      As such, we've elected for now to remove `rAF` and make `highlight`
      code synchronous here.
      
      Fixes #2502
      03f1821b
    • Robert Knight's avatar
      88b3b4f1
    • Robert Knight's avatar
      Remove jQuery usage from `Delegator` class · 67d0c469
      Robert Knight authored
      - Replace usage of jQuery for the event bus in `Delegator` with
        `tiny-emitter`, which we use in various other places in the application
      
      - Change the `element` property from a jQuery wrapper to a DOM element
        and adapt the places in `Guest` that referenced it
      
      - Remove the `on` alias for the `subscribe` method and change existing
        users to just use `subscribe`
      
      - Convert the one remaining use of the legacy alternative approach to
        passing configuration to `Delegator` to instead pass options in the
        `super(...)` call. This allows removing support for this from the
        `Delegator` constructor.
      
      - Add basic tests for the `Delegator` base class
      67d0c469
    • Lyza Danger Gardner's avatar
      Extract `findClosestOffscreenAnchor` from `bucket-bar` plugin · 8fb23743
      Lyza Danger Gardner authored
      Extract munging details of `bucket-bar`'s `scrollToClosest` function
      into a temporary JS-migration module; refactor and comment for clarity.
      8fb23743
  7. 24 Sep, 2020 9 commits
  8. 23 Sep, 2020 2 commits
  9. 22 Sep, 2020 1 commit