On Aug 12, 5:57 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> Script tags aren't the only problem with html-who.wcx. It's full of
> document.writeln() calls. If you load this file with XMLHttpRequest after
> the page is loaded, it's far too late to call document.write[ln](). The
> document has already been closed. If it works at all, the first
> document.writeln should replace your page, not insert into it.
>
> I wonder why it works at all with prototype.js (not protocol.js!)?

Right sorry, I think I had displayed/copy/pasted/save the code from a
web display into the wrong file name and used this before finding the
official web site. :-)   I naturally thought of this as a "protocol"
rather than a prototype. Protocol is a term I used often in my career
work. My bad. :-)

> Maybe they aren't using innerHTML as jQuery does? And why does it work with 
> the
> raw Ajax version? Oh! It must be loading synchronously, directly from a
> script tag in the <body> of your document. That might explain it.

In raw, it displayed, but no JS elements were evaluated, as expected.
But no error in displays nor the browser was lost.

In prototype.js, no errors in display, but it did try to evaluate the
embedde scripts. FireBug is saying a function was not defined,
PlayAudioID().  More on this below.

In jQuery, it got totally lost, and now that you mention it,  I think
it behaved as you describe where a  "document.writeln" created a new
page.  But more critically, I had to stop the loading and this may be
related to FireBug, I had to sometimes restart the browser. Possibly
memory corruption crap.  But I also got the idea that it might be a
string limit for eval hence why the question.  More below.

> If that's why it is working, there's a chance that it would work with jQuery
> too, if you do the $.load call directly in an inline script - not in a
> $(document).ready() or $() callback - and specify synchronous loading.

After further looking into it, and I'm not done,  prototype.js failed
because one of the JS files had a lengthy /* */ block comment at the
top using a <SCRIPT> example and believe it or not, it was trying to
evaluate the <script> string that was within the /* */ comment
block. :-)   A bug!   Once I removed the comment, it loaded but
nothing is happening with the eval() of the loaded script.   Stepping
into prototype.js I was able to see the entire script but it didn't
"act" on the script.  Can't explain this yet.

> I don't know why your scripts aren't being executed, but first I'd address
> the loading issue. Then a good way to troubleshoot it would be to add a
> debugger; statement at the first line of the evalScripts() function in
> jquery.js and trace through the function in your favorite debugger (e.g.
> Firebug).

Yeah,  FireBug is the BOMB! <g>  Been able to crash it a few times,
but an incredible tool.   It needs to add a watch string expansion
display limit like other debuggers have.  While debugging jQuery,
FireBug tried to expand the script string I was watching and PUFF -
Lockup and GPF!

Finally, as jQuery documents and recommends, when I used
$.getScript() at the top level page, it all worked fine.

html-who.wcx opens and processed a "who.htm" template where it has in
the head block:

<head>
...
@IF HasNewMail@
<script type="text/javascript" src="/public/soundmanager2.js"></
script>
<script type="text/javascript" src="/public/wcAudioPlay.js"></script>
<script type="text/javascript">PlayAudioID('NewMail');</script>
@endif@

</head>

The @xxx@ stuff is server-side conditional macro code to only add the
scripts lines if the user has new mail waiting.   This is explains why
last week when I did use this html-who.wcx with jQuery for part of my
quick testing, it appeared to work great. But I must of tested it when
there was no new mail for the test user.

But yes, I can get it to work when load the two scripts before the
ajax call.   Of course, that means that it isn't cut and dry to load a
so call "widget" into a HTML element viewport. :-)

So sweat, as long as I know of the limitations,  you do what you can
and don't do what you can not. :-)

--

Reply via email to