Skip to content

Commit

Permalink
FLUID-5872: Added a comment and refactored src setting
Browse files Browse the repository at this point in the history
Moved the setting of the iframe source to after the binding of the "load" listener
to ensure that the load event isn't triggered before binding to the event.
  • Loading branch information
jobara committed Aug 15, 2016
1 parent c4cce96 commit 975e758
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/component-tests/tooltip/js/TooltipTests.js
Expand Up @@ -212,7 +212,6 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
});

fluid.tests.tooltip.FLUID5846.setupIframe = function (that, iframeSrc, iframe) {
$(iframe).attr("src", iframeSrc);
$(iframe).load(function () {
// DO NOT MOVE this property access outside this function!
var dokkument = iframe.contentDocument;
Expand All @@ -221,6 +220,11 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
that.iframeBody = iframejQuery("body", dokkument);
that.events.iframeReady.fire();
});

// Programmatically setting the iframe src to ensure that the load event
// is triggered after we have bound our listener.
// see: https://issues.fluidproject.org/browse/FLUID-5872
$(iframe).attr("src", iframeSrc);
};

fluid.defaults("fluid.tests.tooltip.FLUID5846.parent", {
Expand Down

0 comments on commit 975e758

Please sign in to comment.