]> git.gir.st - VimFx.git/commit
Keep the largest scrollable element up-to-date
authorSimon Lydell <simon.lydell@gmail.com>
Sat, 14 Nov 2015 11:52:50 +0000 (12:52 +0100)
committerSimon Lydell <simon.lydell@gmail.com>
Sat, 14 Nov 2015 11:52:50 +0000 (12:52 +0100)
commit4958beb3bdf8b7288eeafb6d56b27c9d25da20a2
tree1c0302a2415ec66bacacdc84da46081ee460b68a
parentd41fc98be643e88e5afa7941ccf7bdaa1e7d02bf
Keep the largest scrollable element up-to-date

We used to not try to find a new largest scrollable element if the currently
largest scrollable element underflowed (stopped being scrollable), because it
was considered "unlikely". That might be true for "classic static" web pages,
but it is not for JavaScript-heavy sites, such as groups.google.com, which may
replace most of the DOM at any time. Therefore, we now _do_ try to find a new
largest scrollable element when the old stops being scrollable.

The above required changing the storage for the scrollable elements from a
`WeakSet` to a `Set`, in order to be able to enumerate the set. The reason
`WeakSet` was used before was to avoid memory leaks. However, that should not be
a problem, because we now remove elements removed from the DOM from the set,
because of the next paragraph. Also, all state is wiped when the page is left.

Unfortunately, the 'underflow' event is not fired for scrollable elements
removed from the DOM. Therefore that is tracked separately using
`MutationObserver`s.

See #605.
extension/lib/events-frame.coffee
extension/lib/vim-frame.coffee
Imprint / Impressum