Problem/Motivation
Each time Drupal.behaviors.dialog.attach()
is called it creates a new function which calls the previous settings.dialog.close
function resulting in a never ending chain of functions calling each other. The first time the attach behavior is called it creates a copy of the original close function found in dialog.js (this is the intended behavior), but then each subsequent attach behavior creates a copy of the function created from the last time the Drupal.behaviors.dialog.attach()
function was called.
Proposed resolution
Only overwrite the settings.dialog.close
function once.