J
joe
I often would like see the HTML output produces by my Javascipt code for
debugging. Is this possible?
debugging. Is this possible?
I often would like see the HTML output produces by my Javascipt code for
debugging. Is this possible?
joe said:I often would like see the HTML output produces by my Javascipt code for
debugging. Is this possible?
Try this as a bookmarklet:
javascriptdocument.documentElement||document.body).innerHTML.replace(/&/g,"&").replace(/</g,"<").replace(/\n/g,"<br>");
SAM said:Lasse Reichstein Nielsen a écrit :
Arrrggghh !
where are gone the so lovely indentations of my html code ?
joe said:I often would like see the HTML output produces by my Javascipt code for
debugging. Is this possible?
SAM said:Lars Rune Nøstdal a écrit :
Tremendous ! I had it in my HD and not yet tried.
Does that reveal code gotten via XHR ? (a kind of virtual code)
SAM said:Lasse Reichstein Nielsen a écrit :
Arrrggghh !
where are gone the so lovely indentations of my html code ?
yes
by the way .. check out firebug if you haven't already, it's great
Depends. They might have gone away when the page was parsed (innerHTML
uses the DOM, which might or might not retain whitespace).
But you can try:
javascript:"<pre>"+(document.documentElement||document.body).innerHTML.replace(/&/g,"&").replace(/</g,"<").replace(/\n/g,"<br>").replace(/\x20/g,'\xa0')+"</pre>";
which should be more readable.
Evertjan. said:joe wrote on 02 apr 2008 in comp.lang.javascript:
I often would like see the HTML output produces by my Javascipt code for
debugging. Is this possible?
Try a browser.
===============
Oh perhaps you wnt to see the reconstructed HTML from the DOM?
[Javascript generally does not produce HTML code,
but can and often does change the DOM.]
Send the obj.innerHTML to a new window.
Lasse Reichstein Nielsen said:Try this as a bookmarklet:
javascriptdocument.documentElement||document.body).innerHTML.replace(/&/g,"&").replace(/</g,"<").replace(/\n/g,"<br>");
(I.e., either paste it into the address line, or, for reuse, create it as
a bookmark)
/L
Usually i do have a <pre id="log"></pre> for testing purpose in my page
and instead of doing alert (the timing is broken) i do :
var myText="Starting point at "+new Date().getTime();
myText+="another blahblah";
...
by the end :
document.getElementById("log").appendChild(document.createTextNode(txt))
beegee said:I kind of like this except for the vagueness around "starting point"
and "end". I assume you mean within functions after onload, not in
global javascript.? Thanks.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.