Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't delete event handlers in messages on layout/resize
When `layout` was called, it rebuilt the messages area from scratch using its html. This resets any event handlers on nodes embedded in these, so a layout would strip out event handlers from the input box, including the ones that return the game to its normal state once you're done with the box. The result was that you had to reload the browser to get something playable. This was triggered by any resize, which in several browsers (and possibly sensitive to other settings, such as zoom) can result from a browser find command (10318), especially since crawl doesn't swallow ctrl-f when the search box was open. A re-layout is also apparently triggered when a spectator joins (10938). This fix, instead of rebuilding the messages panel from html, makes a deep copy of it using jquery `clone`, in a way that preserves event handlers. Layout still copies other areas using html, so if anyone ever adds any event handlers in the stats area, this could come up again. Supposedly, the html way is faster, so I left this as-is. (I'm not entirely sure why this would be the best way to do what `layout` is doing in the first place, but I'll leave that for more skilled javascript people.)
- Loading branch information