From 975e758cde7add9dc14d6f768588f27d52d8eaaf Mon Sep 17 00:00:00 2001 From: Justin Obara Date: Mon, 15 Aug 2016 12:32:18 -0400 Subject: [PATCH] FLUID-5872: Added a comment and refactored src setting 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. --- tests/component-tests/tooltip/js/TooltipTests.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/component-tests/tooltip/js/TooltipTests.js b/tests/component-tests/tooltip/js/TooltipTests.js index da93650c7e..59cf6c7031 100644 --- a/tests/component-tests/tooltip/js/TooltipTests.js +++ b/tests/component-tests/tooltip/js/TooltipTests.js @@ -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; @@ -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", {