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

Ticket #5868 (closed defect: untested)

Opened 2 years ago

Last modified 1 year ago

[PATCH] scriptaculous.js doesn't support rewritten URLs

Reported by: jxue01@digizenstudio.com Assigned to: thomas@fesch.at
Priority: normal Milestone:
Component: script.aculo.us Version:
Severity: minor Keywords:
Cc:

Description

As of 1.6.2 if the URL used to load scriptaculous.js has been rewritten(i.e., has session id), and/or has additional parameters, they are not used to in forming the component js files. This small patch corrects it. It's tested in FF 1.5 and IE6.

37c37
<       return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
---
>       return (s.src && s.src.match(/scriptaculous\.js(;.*)?(\?.*)?$/))
39d38
<       var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
42c41,44
<        function(include) { Scriptaculous.require(path+include+'.js') });
---
>        function(include) {
>               var includeJS = s.src.replace(/scriptaculous\.js/, include + '.js');
>               Scriptaculous.require(includeJS);
>        });

Change History

08/29/06 18:13:23 changed by madrobby

Can you give some examples of complete URLs for which the current method fails? I'd like to refactor the scriptaculous.js loader a bit so we can have some unit tests for this.

08/30/06 07:46:01 changed by jxue01@digizenstudio.com

One example would be in a java web application, where a client has cookie disabled in her browser, so after url rewriting, 'http://server/foo.js' becomes 'http://server/foo.js;jsessionid=12345'.

In addition, in my application, I always add a 'versionToken' parameter to all the urls to static files, including scriptaculous files. That way whenever I update these files, I can change the parameter value to force client browsers to reload. The patch I submitted also keeps the additional parameters in a URL.

09/03/06 18:57:46 changed by madrobby

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

04/27/07 11:35:30 changed by yannc76

using 1.7.1_beta1 I ran into this bug - should it not be fixed already?