title: What is causing this recursion with my jQuery calls?
body: <p>I currently have some code written that will call a function after a custom <code>.trigger()</code> call. This is what is called:</p>
  
  <pre><code>function _visitAddTag(state, listener) {
          if (state.properties.action = "RedoAddTag") contextMenu.unhide();
          var $target = contextMenu.getContextMenuUI().tags; // Grab tag elements
          var callback = function () {
              if (listener) {
                  google.maps.event.removeListener(listener);
              }
              $target.off("tagIds-updated", callback);
              contextMenu.hide();
              next.call(contextMenu.getTargetLabel(), state.transition);
          };
          $target.on("tagIds-updated", callback());
      }
  </code></pre>
  
  <p>The <code>next.call()</code> line causes this method to be triggered: </p>
  
  <pre><code>function () { // 'this' is contextMenu.getTargetLabel(), as called in Onboarding.js/_visitAddTag()
                  tracker.push('Onboarding_Transition', {onboardingTransition: "tag-attribute-1"});
                  var tags = this.getProperty('tagIds');
                  return tags == [2] ? "adjust-heading-angle-1" : "redo-tag-attribute-1" // Where 2 is the tag_id of the "points into traffic" tag
              }
  </code></pre>
  
  <p>Where a return value of <code>"redo-tag-attribute-1"</code> will cause the whole thing to loop again. </p>
  
  <p>I see the potential for recursion here, especially if the <code>"tagIds-updated"</code> event is somehow triggered inside of the second function call. However, when I debug the code, that event is only triggered once. Does anyone have any ideas as to what is happening here? I'm a javascript newb so maybe I'm missing something obvious. </p>