The debounce is trailing, not leading/throttled. This means
the value doesn't decide how often it runs while the user is
resizing. It decides how long after they stop resizing will
it first run.
Given the calculation isn't super expensive, a much lower value
should suffice. The main thing we want is that while the user
is actively resizing and 100s of events are queued up (faster than
JS can process), that we wait until the end of the chain before
computing it (once). If the user actually stops moving, even for
a little bit, that little bit however small should be more than
long enough for a repaint to take place.
Test Plan:
* Open two tabs, one after checking out master, and
one after checking out this patch. Make sure you are logged-in
on MW as an administrator user (to get more tabs).
* Verify that `mw.loader.getVersion('skins.vector.js')` returns
different values from the console for each.
* Resize the window from wide to very narrow and back.
Before, the tab bar updates relatively late it feels sluggish.
After, the tab bar appears to update as/while you let go.
Change-Id: If02338559abc71668d0655e8b3be1a5f73e646a9
Update the 'expandedWidth' after we expand in case someone was brazen
enough to change the tab's contents after the page load (gasp).
This doesn't prevent a tab from collapsing back and forth once, but at
least it won't continue to do that forever. This should reduce the
issue from completely awful to mildly annoying.
Bug: T71729
Change-Id: I46bd6584c0f2ddebc4aa7d1103cff1715e1510a5
* Rename 'rtl' to 'isRTL' and use DOM to compute its value.
* Document code with JSDuck similar to other extensions.
* Remove unused 'prevElement' property. Not used in Vector
nor anywhere else in Wikimedia Git.
* Make 'boundEvent' property private. Not used anywhere in
Wikimedia Git outside this file.
* Simplify 'instances' tracking.
The jQuery object stored in this property wasn't used beyond
calling each(). Convert to a plain array.
Preserve and re-use the jQuery object first created
by collapsibleTabs().
* Simplify calculateTabDistance() by using getElementById() and
getBoundingClientRect(). Its support includes IE 5.
The "new" version (since Firefox 3.5 and IE 9) also includes
'height' and 'width' properties and is supported in all
browsers supported by the MediaWiki 1.28 startup feature test.
This helps avoid code in offset() and width(), which is fairly
expensive in jQuery 1.x.
* moveToCollapsed()
- Remove redundant jQuery object creation (only caller passes a
jQuery object already).
- Remove redundant re-receiving of expContainerSettings inside
the animate() callback. Already in the main scope.
Relates to a bunch of patches that work around a problem
caused by use of remove() instead of detach() in an earlier
version of the code. Which was only a problem because the
other settings object was also not used from the main scope.
(See pre-Gerrit commits 1f93310e and e7900807.)
Change-Id: I48d542580d767df2d17ce4c6668e9e233a0f7902
We treat this as a jQuery object throughout the code, but it was
initialized to an array.
Bug: T109259
Change-Id: I44c10683ded05656eb7ca1b4be43ddc4f9281076