Hi.

You can jump straight the *** QUESTION *** if you want.

*** BACKGROUND ***

I have my own library of extensions, arranged in a manner similar to
Scriptaculous.

By using the same mechanism to load my library files as Scriptaculous,
I can edit single files and test.

But it is not working, and I'm stuck, but I think I've found my
problem. I just need a little pointer on fixing it.

It all seems to relate to ...

$A(document.getElementsByTagName("script"))

I've put together a small test ...

The HTML file loads Prototype.js (V1.5.1), a simple inline test script
and then Scriptaculous.js (V1.7.0).

In my real code, I load Prototype, Scriptaculous and then my library.

It then reports back, via the inline code, any JS paths or INLINE.

Reports are generated when :

1 - During processing of <head> and therefore my inline code.
2 - After the expected loading of Scriptaculous.
3 - During processing <body>
4 - By the Window.onload event.

When in the <head> tag the output doesn't show scriptaculous. This is
probaly OK the first time, but the second time (i.e. 'After
Scriptaculous'), is isn't.
Both Body and OnLoad correctly report all the files, but
Scriptaculous's files have not loaded.

Basically the scriptaculous library never loads is files (just like
mine wouldn't).

*** QUESTION ***

It seems that the call $A(document.getElementsByTagName("script")) is
cached in some way.

Is there a way to flush this cache prior to calling it again?

Regards,

Richard Quadling.

*** MORE BACKGROUND ***

=============The HTML file==============
<html>
<head>
<script type="text/javascript"
src="/global/javascript/prototype/prototype.js"></script>
<script type="text/javascript">
function ReportJS(s_When)
        {
        $A(document.getElementsByTagName("script")).each(
        function(s)
                {
                console.info(s_When, !!s.src ? s.src : 'inline');
                });
        }
ReportJS('With Reporter');
function ViaOnLoad()
        {
        ReportJS('OnLoad');
        }
Event.observe(window, 'load', ViaOnLoad);
</script>
<script type="text/javascript"
src="/global/javascript/script.aculo.us/scriptaculous.js"></script>
<script>ReportJS('After Scriptaculous');</script>
<title>JS Test</title>
</head>
<body><script>ReportJS('Body');</script></body>
</html>
=============================

The test is nothing more than a report for FireBug's console.

With Reporter http://local.quickscripts/global/javascript/prototype/prototype.js
With Reporter inline
After Scriptaculous
http://local.quickscripts/global/javascript/prototype/prototype.js
After Scriptaculous inline
Body http://local.quickscripts/global/javascript/prototype/prototype.js
Body inline
Body 
http://local.quickscripts/global/javascript/script.aculo.us/scriptaculous.js
Body inline
Body inline
OnLoad http://local.quickscripts/global/javascript/prototype/prototype.js
OnLoad inline
OnLoad 
http://local.quickscripts/global/javascript/script.aculo.us/scriptaculous.js
OnLoad inline
OnLoad inline

-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to