Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9032 (closed enhancement: fixed)

Opened 10 months ago

Last modified 1 week ago

[PATCH] Rewrite scriptaculous.js so that the loader trick can be used by other scripts

Reported by: sokrat3s Assigned to: madrobby
Priority: normal Milestone: 1.x
Component: script.aculo.us Version: edge
Severity: normal Keywords:
Cc:

Description

This patch rewrites scriptaculous.js so that the loader trick can be used twice. Firefox does not allow it to use the doc.getElementsByTagName() twice during load. Closes #4335. The solution is done by petermichaux, I only merged the two revisions.

Attachments

fix_scriptaculous_loading_rewrite.diff (2.8 kB) - added by sokrat3s on 07/20/07 06:30:16.

Change History

07/20/07 06:30:16 changed by sokrat3s

  • attachment fix_scriptaculous_loading_rewrite.diff added.

08/07/07 13:29:30 changed by madrobby

  • status changed from new to closed.
  • resolution set to untested.

Please add a test for this and reopen. Looking good to me.

12/17/07 23:30:30 changed by staaky

  • status changed from closed to reopened.
  • type changed from defect to enhancement.
  • resolution deleted.

By using $$ instead of getElementsByTagName you can avoid this limitation much easier. I've tested the following change, in combination with a number of other scripts that use the same loader, they play nice together.

In case you need a testcase, here's an extension running alongside a modified scriptaculous using the same loader.

replaced

$A(document.getElementsByTagName("script")).findAll( function(s) {
  return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))

with

$$("head script[src]").findAll(function(s) {
  return s.src.match(/scriptaculous\.js(\?.*)?$/);

01/31/08 04:34:05 changed by kangax

+1 for $$ instead of getElementsByTagName

05/05/08 23:21:09 changed by staaky

  • status changed from reopened to closed.
  • resolution set to fixed.

Fixed in git