-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Fred wrote:
>>> The test page for 276037 still works.
>> Yes, but that test isn't so easy to choke ;-)
> Do you mean it's too simple? It demonstrates the issue, which is all it
> needs to do.
You just proved my point, it doesn't (see below) ;-)
> Why is getLastElementByTagName so complicated? I don't understand the
> purpose of recursion over descendant nodes rather than just getting the
> last member from the collection returned by getElementsByTagName.
Because of the subject of this topic - getElementsByTagName fails (at
least on Gecko) while document is loading. Run my test on Gecko and you
will see lots of red labels (errors). Please view source :)
> As for your loader function, you seem to make provision within your
> scripts array to include different paths, so why not do that and
> dispense with getting the path of the current script element
> altogether? The whole function then becomes a simple iteration over
> the scripts array with document.write to add them. ;-)
Wrong, as this means scripts have paths relative to the current
_document_ (vs current _script_).
e.g.: Page "/myapp/index.html" includes a "js/load.js". Using your
simplification...
> <script type="text/javascript" src="load.js"></script>
<script type="text/javascript" src="js/load.js"></script>
> Where load.js is:
>
> (function(){
> var scripts = ['foo.js', 'bar.js'];
> for (var i=0, len=scripts.length; i<len; i++){
> document.write('<script type="text/javascript" src="'
> + scripts[i] + '"><\/script>');
> }
> })();
<script type="text/javascript" src="foo.js"></script>
^ absolute path would be "/myapp/foo.js", which obviously is incorrect,
as "myapp" modules are stored in "/myapp/js/".
Anyway, that loader is just a lazy example, to prove that it can load
correctly even scriptaculous (with is own buggy loading procedure).
Obviously, it can be improved to support even more complex paths, like
"../lib/", etc.
cheers
- --
Marius Feraru
-----BEGIN PGP SIGNATURE-----
iD8DBQFFf6rKtZHp/AYZiNkRAhrsAJ0cJqJYyV3oaiyffEKzmRXJ1bl3NgCfSSFS
utCAkjFhjuV1Hd17v6BB0hs=
=ALmr
-----END PGP SIGNATURE-----
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---