Investigate possible double firing of NEW_CONTENT_ADDED events

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: High
    • None
    • Affects Version/s: 5.1
    • Component/s: None
    • 5.01

      The NEW_CONTENT_ADDED event is fired when new content is added to the dom. Its 'context' parameter is the DOM node that was actually added.

      The contract of this event is that it will never be fired for the same dom node twice, including parent relationships.

      So, for example, if a node exists in the DOM tree and we fire NEW_CONTENT_ADDED on its parent, we can never fire for a child that existed at that time. We can only fire the event when new content is actually added to the tree, and the context is strictly the node that was added.

      It's been reported that developers have seen this incorrect behaviour occurring. Two bug fixes have been made based on this behaviour:

      We should investigate to see if NEW_CONTENT_ADDED is being fired twice on the same dom node - if so this is a bug that will affect all plugin devs and must be fixed.

      This code might help detect the bug - it will log an error message to the console if NEW_CONTENT_ADDED is seen twice for a node in the given context.

      JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, $ctx, reason) {
          var $els = $ctx.find("*").andSelf();
          if ($els.filter(".i-have-been-seen").length) {
              console.log("OHNOES - it's a NEW_CONTENT_ADDED bug");
          }
          $els.addClass("i-have-been-seen");
      });
      

            Assignee:
            Jonathon Creenaune
            Reporter:
            Jonathon Creenaune
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: