Board Thread:Watercooler/@comment-26402117-20181122142748/@comment-26402117-20181130105739

OneTwoThreeFall wrote: Seems good! Though at line 223/224 of Chat-js.js, I'm not sure why  class is removed and immediately added back.

I did notice some small styling issues but not sure if they're directly Chat-js related, or just issues in WDS. Notice the top border has a 1px gap at the top-left of each button, and the dropdown seems to be inconsistently coloured. Also, if all items are in the dropdown, the dropdown has no left border.

In the case where there are buttons in the main list and dropdown, the  class isn't consistently present. So the script accounts for: I think I also confused myself when writing it, so I've [/index.php?diff=103416&oldid=103402 made it less redundant & muddled] now.
 * whether the class is already there (not in dropdown; will result in duplicate class)
 * making sure  is a higher priority class

The dropdown coloring is entirely in Chat-js, so it's likely a bug there. I'll have a look at styling fixes today, thanks for reporting.

One thing I wonder (but not directly related to this change) is why  is used? Unless you need to support IE8, the native  function seems a better choice. Also, relying on an animation event seems fragile, but if you have no alternative… Bind sounds okay. I believe bind does not override function guid, but a well named jQuery event namespace can deal with that. :)

The animation event has been more reliable than the other methods (setInterval, MutationObserver etc). But yes, perhaps something more DOM-agnostic would be useful.

Here's one solution:
 * 1) for   event, chain 'mediawiki.api' event with load event of the chat_js2 script (in comination with  ). A custom   Deferred promise would be effective.
 * 2) bind to the 'initial' event of mainRoom for  . Code's in the Chat-js documentation.

Due to Chat's nature, I'd have to do a lot of testing to verify it can achieve the same load order in all cases. Chat events are slower than one would expect, but if it's one event to listen for, that's arguably fine.