The 'ejectorseat' behavior defined in ejectorseat.js is being attached to the 'window' DOM element on every page callback regardless of whether it is an AJAX request. This means that when doing something such as clicking around in a views UI, it is being attached a large number of times.

For each application of the behavior, a new 60 second timer is set. Using the 'once' jQuery method that was introduced into D7 core here we are able to avoid this. I'm submitting a patch below to implement this!

Comments

fenda’s picture

Issue summary: View changes
StatusFileSize
new3.07 KB
fenda’s picture

Issue summary: View changes
BrockBoland’s picture

I tested this in both Chrome and Firefox and found that the once() function isn't being run (I stuck a console.log inside the anon function to check). It doesn't work for window or document, but does using the 'body' selector…except then, it runs on ajax calls too.

I'm not sure if the once plugin has any weird behaviors when it comes to attaching to document or window, and haven't had any luck finding info. Any ideas?

RemovE’s picture

Everything is working for me when I changed ejectorseat.js(15) one line.

From:
$(window, context).once('ejectorseat', function() {
To:
$(document.body, context).once('ejectorseat', function() {

matthiasm11’s picture

Applying the patch from #1 and than changing as explained in #4 worked for me, startTimer() is only called once when editing a view for example.

nwom’s picture

Status: Active » Needs review
StatusFileSize
new3.08 KB

Attached is a new patch that incorporates the changes from #4 into #1. Please review.

elc’s picture

Assigned: fenda » Unassigned
Status: Needs review » Reviewed & tested by the community

An important fix which should be ported to D8+ version too.

  • elc committed 730e6793 on 7.x-1.x
    fix: #2161907 Only attach JS behaviors once
    
    By: fenda
    By: BrockBoland...
elc’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.