Wait until external script executes

66 views
Skip to first unread message

pandu ranga

unread,
May 18, 2017, 11:30:39 AM5/18/17
to jsdom
Hi,

I am facing an issue with the JSDom could you please help me to resolve the issue.  when i am loading the external file which loads some files through steal and render the html.

when i am executing the below code i am always getting the empty dom.  How to load a file after the external scripts got executed and the dom is ready. Thanks 





jsdom.env({
    url: 'index.html',
    features : {
          FetchExternalResources : ['script'],
          ProcessExternalResources : ['script'],
          runScripts: "dangerously"
      },
    done: function(errors, window){
        var $ = window.$;
        $(window.document).ready(function(){
          console.log(window.document.body.innerHTML);
        });
        //console.log(window.$);


      //    var bc = $('#text-input-example0').getComponent();
        //  console.log(bc);
        //  var ab = $('#text-input-example0_mca_input').val();
        //  console.log(ab);

    }
});


index.html


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!--[if lt IE 7]> <html lang="en" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="en" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="en" class="no-js lt-ie9 ie8"> <![endif]-->
<!--[if gt IE 8]> <html lang="en" class="no-js"> <![endif]-->
<html lang="en">
<head>
<link rel="icon" href="favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>MCA UI Foundation Components</title>
<script type="text/javascript" src="../../container/jquery/jquery.js"></script>
<script type="text/javascript" src="../../container/steal/steal.js"></script>
<script>
steal.map( { '/container': '.' } ); if ( $.browser && $.browser.msie ){
// window.location.href = 'noie.html';
$.fx.off = true;
}
$( document ).ready( function() {
steal( 'catalog/init.js' );
} );
</script>
</head>
<body id="scp-touchMode-off">
</body>
</html>






















Reply all
Reply to author
Forward
0 new messages