Uploaded image for project: 'Fluid Infusion'
  1. Fluid Infusion
  2. FLUID-3679

JavaScript error "'script.parentNode' is null or not an object" on IE when running multiple instances of fluid (swfobject.js)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1, 1.1.1, 1.1.2, 1.2beta1, 1.2
    • Fix Version/s: 1.1.3, 1.2.1, 1.3
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      IE browser, all versions (afaik)

      Description

      The swfobject.js dependency, included with Fluid Infusion, causes A JavaScript error on IE browsers when you run more than 1 copy of fluid on a page. (Note: this is something we do commonly in uPortal – each portlet loads & uses its own copy.)

      The error is caused when JS attempts to call 'script.parentNode.removeChild(script)' on the same element more than once.

      Eyeballing the code, it looks as though this issue is fixed in swfobject 2.2: http://code.google.com/p/swfobject/downloads/detail?name=swfobject_2_2.zip

      Would it be possible to bump the embedded version of swfobject to 2.2?

              • OFFENDING CODE *****
                /* Cross-browser onDomLoad
      • Based on Dean Edwards' solution: http://dean.edwards.name/weblog/2006/06/again/
      • Will fire an event as soon as the DOM of a page is loaded (supported by Gecko based browsers - like Firefox -, IE, Opera9+, Safari)
        */
        var onDomLoad = function() {
        if (!ua.w3cdom) { return; }

        addDomLoadEvent(main);
        if (ua.ie && ua.win) {
        try { // Avoid a possible Operation Aborted error
        doc.write("<scr" + "ipt id=__ie_ondomload defer=true src=//:></scr" + "ipt>"); // String is split into pieces to avoid Norton AV to add code that can cause errors
        script = getElementById("__ie_ondomload");
        if (script)

        { addListener(script, "onreadystatechange", checkReadyState); }

        }
        catch(e) {}
        }
        if (ua.webkit && typeof doc.readyState != UNDEF) {
        timer = setInterval(function() { if (/loaded|complete/.test(doc.readyState)) { callDomLoadFunctions(); }}, 10);
        }
        if (typeof doc.addEventListener != UNDEF)

        { doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, null); }

        addLoadEvent(callDomLoadFunctions);
        }();

      function checkReadyState() {
      if (script.readyState == "complete")

      { script.parentNode.removeChild(script); callDomLoadFunctions(); }

      }
      *****

        Attachments

        1. FLUID-3679-trunk.patch.txt
          37 kB
          Harris Wong

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            awills Drew Wills
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: