@@ -181,23 +181,25 @@ public function testItCanRunAsyncWidgetWithoutJquery()
181181 $ expected =
182182 '<div id="arrilot-widget-container-1" style="display:inline" class="arrilot-widget-container"> ' .
183183 '<script type="text/javascript"> ' .
184- 'var xhr = new XMLHttpRequest(); ' .
185- 'xhr.open("GET", " ' .$ this ->ajaxUrl ('TestDefaultSlider ' ).'", true); ' .
186- 'xhr.onreadystatechange = function() { ' .
187- 'if(xhr.readyState == 4 && xhr.status == 200) { ' .
188- 'var container = document.getElementById("arrilot-widget-container-1"); ' .
189- 'container.innerHTML = xhr.responseText; ' .
190- 'var scripts = container.getElementsByTagName("script"); ' .
191- 'for(var i=0; i < scripts.length; i++) { ' .
192- 'if (window.execScript) { ' .
193- 'window.execScript(scripts[i].text); ' .
194- '} else { ' .
195- 'window["eval"].call(window, scripts[i].text); ' .
184+ 'setTimeout(function() { ' .
185+ 'var xhr = new XMLHttpRequest(); ' .
186+ 'xhr.open("GET", " ' .$ this ->ajaxUrl ('TestDefaultSlider ' ).'", true); ' .
187+ 'xhr.onreadystatechange = function() { ' .
188+ 'if(xhr.readyState == 4 && xhr.status == 200) { ' .
189+ 'var container = document.getElementById("arrilot-widget-container-1"); ' .
190+ 'container.innerHTML = xhr.responseText; ' .
191+ 'var scripts = container.getElementsByTagName("script"); ' .
192+ 'for(var i=0; i < scripts.length; i++) { ' .
193+ 'if (window.execScript) { ' .
194+ 'window.execScript(scripts[i].text); ' .
195+ '} else { ' .
196+ 'window["eval"].call(window, scripts[i].text); ' .
197+ '} ' .
196198 '} ' .
197199 '} ' .
198- '} ' .
199- ' } ; ' .
200- 'xhr.send( ); ' .
200+ '}; ' .
201+ ' xhr.send() ; ' .
202+ '}, 0 ); ' .
201203 '</script> ' .
202204 '</div> ' ;
203205 $ this ->assertEquals ($ expected , $ output );
0 commit comments