From b4f1ffd4eaaa47e0e3a39dde27d414890aa5de78 Mon Sep 17 00:00:00 2001 From: lidlanca Date: Fri, 30 Jan 2015 01:57:44 -0500 Subject: [PATCH] Fix: Resize event handler does not get cleared from window object,by wrong usage of jQuery api. An handler get added each time a topic is loaded to the window object jQuery resize api only pass data to the handler when triggered. ```.resize( [eventData ], handler ) ``` The unbind followed in willDestroyElement had no affect. .on(...) or bind(..) support the event.namespace fix was not tested. --- app/assets/javascripts/discourse/views/topic.js.es6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/views/topic.js.es6 b/app/assets/javascripts/discourse/views/topic.js.es6 index a54ac073863..bed33a452d3 100644 --- a/app/assets/javascripts/discourse/views/topic.js.es6 +++ b/app/assets/javascripts/discourse/views/topic.js.es6 @@ -40,7 +40,7 @@ var TopicView = Discourse.View.extend(AddCategoryClass, Discourse.Scrolling, { this.bindScrolling({name: 'topic-view'}); var self = this; - $(window).resize('resize.discourse-on-scroll', function() { + $(window).on('resize.discourse-on-scroll', function() { self.scrolled(); });