We added this more as an experiment because we couldn't reliably
figure out what makes later .offset() calls fail. After looking into
the actual jQuery source code I realized the only way .offset() can
return undefined is when .length is zero. Which means the two checks
are redundant and one can be removed.
In case an element is not attached to the document an object with
{ top: 0, left: 0 } is returned.
Bug: T342556
Change-Id: I6265fd27b3102a9cfe853a9c0e11063b76cf0b7b
Otherwise the `this` to call addColoredColumnBorders() inside of
that function is unkown when triggering the callback.
Can be verified working when collapsing the slider on master vs
this patch.
Regression introduced in Icffe9551d633470ccec1b63ea570e138db48dee8
Change-Id: I653db133688d7678d0cb3b80936c7e9a7ebebd1f
The offsetNotAvailable method is part of the class ever since it was
created in Iadf7793. It always only checked one of the two columns.
This confuses me, to be honest. The PointerLine class is meant to have
exactly two instances: One for the left (yellow) and one for the
right (blue) lines. There should be no reason the left reaches into
the right, and vice versa.
Bug: T342556
Change-Id: I31117b3a6bb73c397f7702cb3b162276de1a77ca
Turns out this code can only ever access a single underline: The one
it owns and can access via it's own this.$html property. One of the
two jQuery selectors always turned out empty, and calling .css() or
anything else on an empty jQuery collection just doesn't do anything.
This patch also contains a similar, but technically unrelated
cleanup in the init code.
Change-Id: Ic89b11971f51f5dcca67dcbd308f65310f48f0ec
Reintroduces IIFE closures in test files because variables were
declared in the global namespace, and "const" now causes hard errors.
Bug: T339323
Change-Id: I69e9d7a29591137f185f3e5ab02dea590ec4dff6
… and replace them with more trivial `function …() {}`. I
believe this does not make any difference. But I feel this
makes the code a little more straightforward.
The motivation for this patch is because a few other patches
change some of these function declarations, leaving a (in my
opinion) confusing mixture of styles behind.
Change-Id: Ib8928c4176a963afcf1fee1c785dd7bdc86c9706
In my PHPStorm IDE, this makes it possible to follow all methods and
properties in these classes, even these that are later defined.
Otherwise only the empty stub of each class is found.
This might be different in other IDEs.
Basically: PHPStorm does not understand the meaning of the $.extend()
syntax from jQuery without these hints.
Change-Id: I4aa76db183122f6669dc72561441f46f0056d793
Pointers can always be identified as the pointer for the "older" and
"newer" revisions. Class nameing was cleaned up and changed accordingly.
Change-Id: Id17878e780b5a405b196fdc5ec7429eeaef5bd4c
It seems the magic done with the 4px margin and its calculations
are not really needed. Getting rid of this does not only clean
the code but is also very helpfull for the new slider logic.
Change-Id: Iae86b8024d3b56517bdc4db5e8baec69bd61afbf
Introducing a new class that draws lines between the pointers
and the related diff columns. Lines are redrawn when pointers
were moved. A colored border is added to the diff columns and
readded when the diff changes.
Bug: T149175
Change-Id: Iadf779368c58da7779c769bda8e9bd3fc5afcffa