Make the code for float banners more performant and self-contained.

Review Request #2283 — Created April 13, 2011 and submitted

Information

Review Board

Reviewers

Make the code for float banners more performant and self-contained.

This improves upon Mark's float banner code to be a bit more performant.
We modify the DOM a bit less and loop over elements far less often. Now,
each float banner is managed by a $.fn.floatReplyDraftBanner function,
which connects window resize and scroll events directly to that banner.
This is a bit nicer than iterating over the DOM looking for float banners
to update each time, since it's far faster to get the banners we care about.

It also fixes some bugs with spacing and problems when a banner is placed
on a review with a Ship It. It also no longer attempts to float when a
review is collapsed.

The code to create a draft banner has also been pulled out into a
$.replyDraftBanner function.
Tested that the banners work well with several banners, some with Ship It
and some without, and that they float while in view with the same accuracy
as the old banner code.
Loading...