Note that there are some explanatory texts on larger screens.

plurals
  1. PODebugging jQuery Mobile injected scripts
    text
    copied!<p>In jQuery Mobile, I can define "mobile pages" as <code>div</code>s with <code>data-role=page</code>.</p> <p>These can be stored in other HTML files, and injected ad-hoc into the main HTML page.</p> <p>In such a <code>div</code> I can put a <code>script</code> tag, and that script will also be injected into my main page.</p> <p>The script does not appear as a <code>script</code> tag in my DOM, but rather seems to be injected inline, and thus it does not appear in a standard way in a debugger e.g. FireBug's script panel.</p> <p>Has anyone found a normal way to debug these scripts (Hopefully in FF or Chrome) ?</p> <p><strong>EDIT:</strong></p> <p>Just to clarify - The script tag in the "other" page is not an inline script. It is a:</p> <pre><code>&lt;div data-role="page" id="some_id"&gt; &lt;script type="text/javascript" src="MyScript.js"&gt;&lt;/script&gt; ... &lt;/div&gt; </code></pre> <p>Still, it is injected as an inline script to the DOM.</p> <p>BTW - if I put the script tag in the HTML's HEAD it is not loaded at all.</p> <p><strong>EDIT 2:</strong></p> <p>More clarifications:</p> <ol> <li><p>I'm writing a framework into which "extension modules" will be plugged on customer site and decision which module (i.e. additional "pages" with scripts) to load is a runtime decision. Therefore I have no prior knowledge in my main page which scripts to load, and must defer loading to "module load" time.</p></li> <li><p>My end goal here is to allow "module" developers to debug their scripts. For this I would like a solution where the references script files are available in FireBug/ChromeDevTools like any other script.</p></li> </ol> <p>It seems like it's standard jquery (core, not mobile) behavior to remove the script tag from a AJAX-loaded html and eval it inline, instead of leaving the script tag there and letting the browser load it normally.</p> <p>I don't really fully understand the motives behind this, and it really hampers my debugging options :-(</p> <p>BTW, I'm using jQuery 1.5.2 (same behavior with 1.5.1) and jQuery Mobile alpha 4 (same with 3)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload