RJS Errors with Safari 3.1

23 views
Skip to first unread message

Jose Fernandez

unread,
Mar 20, 2008, 9:39:45 PM3/20/08
to ActiveScaffold : Ruby on Rails plugin
Since I updated to the latest version of Safari (3.1) this week I'm
getting RJS Erros when trying to update a record. This does NOT
happen in Firefox 2.0.0.12 (Latest version thats not beta 3). I'm
linking screenshots of the two parts of the error messages:

1. http://img207.imageshack.us/my.php?image=picture1jv0.png

2. http://img141.imageshack.us/my.php?image=picture2em3.png

PS. Pretty sure it due to the latest update in Safari, because
another project already in production using ActiveScaffold which I
havent touched in a while is now showing those errors too.

Jose Fernandez

unread,
Mar 20, 2008, 9:43:37 PM3/20/08
to ActiveScaffold : Ruby on Rails plugin
This is also happening when creating new records. The RJS error
message only pops up when running the application in localhost.
Otherwise in production it only sits there doing nothing after you
click update/create

On Mar 20, 8:39 pm, Jose Fernandez <fernandez.joser...@gmail.com>
wrote:
> Since I updated to the latest version of Safari (3.1) this week I'm
> getting RJS Erros when trying to update a record.  This does NOT
> happen in Firefox 2.0.0.12 (Latest version thats not beta 3).  I'm
> linking screenshots of the two parts of the error messages:
>
> 1.http://img207.imageshack.us/my.php?image=picture1jv0.png
>
> 2.http://img141.imageshack.us/my.php?image=picture2em3.png

ash

unread,
Mar 22, 2008, 10:43:14 AM3/22/08
to ActiveScaffold : Ruby on Rails plugin
Does happen in Firefox 3 Beta 4.

On Mar 21, 9:43 am, Jose Fernandez <fernandez.joser...@gmail.com>
wrote:

AkitaOnRails

unread,
Mar 24, 2008, 12:02:35 PM3/24/08
to ActiveScaffold : Ruby on Rails plugin
I can confirm this behavior on my Safari 3.1 as well. It's pretty sure
there is something new in 3.1 that accounts for that, but I am not
sure yet.

AkitaOnRails

unread,
Mar 24, 2008, 12:19:42 PM3/24/08
to ActiveScaffold : Ruby on Rails plugin
Ok, I think I isolated the error. It's in the frontend folder, the
create.rjs (the default one, if you didn't change it) at line 13:

page << "$$(#{cancel_selector}).first().link.close();"

For some reason $$(#{cancel_selector}).first().link is returning
'undefined', so calling close() on it yields the error.

David Richardson

unread,
Mar 24, 2008, 8:13:45 PM3/24/08
to ActiveScaffold : Ruby on Rails plugin
I'm having a tough time seeing whats going on with '.link'. Anyone
else?
It's a problem in update.rjs too. Are 'cancel' links used anywhere
else?

This is somewhat important. Safari 3.1 is out and Firefox 3 is weeks
away.

david

AkitaOnRails

unread,
Mar 25, 2008, 9:53:43 AM3/25/08
to ActiveScaffold : Ruby on Rails plugin
Ok, I figured out the problem.

On active_scaffold.js (make sure you're looking at the copy on your
public/javascript folder), around line #266 there is this code:

this.adapter.getElementsByClassName('cancel').each(function(elem) {

The guys at caboose (http://blog.caboo.se/articles/2008/3/21/
safari-3-1-breaks-your-app) figured out that both Safari and Firefox
implements a new getElementsByClassName() function that breaks
compatibility. The solution (there are variants) is this:

this.adapter.select('.cancel').each(function(elem) {

In this case I am replacing with Prototype's select() mechanism. This
worked for me on Safari 3.1.

On Mar 24, 9:13 pm, David Richardson <david.richard...@channel200.net>
wrote:

David Richardson

unread,
Mar 25, 2008, 10:42:38 AM3/25/08
to ActiveScaffold : Ruby on Rails plugin
Great :-)

'getElementsByClassName' is deprecated - 'select' seems like the best
replacement.

Jose Fernandez

unread,
Mar 26, 2008, 11:30:16 AM3/26/08
to ActiveScaffold : Ruby on Rails plugin
That fixed it for now, thanks!

On Mar 25, 9:42 am, David Richardson <david.richard...@channel200.net>
wrote:

JWP

unread,
Mar 29, 2008, 4:40:33 PM3/29/08
to ActiveScaffold : Ruby on Rails plugin
Thanks for this fix. I would note that anybody who cuts and pastes
this should add a right parenthical after (elem} and before the right
bracket.

On Mar 25, 8:53 am, AkitaOnRails <fabioak...@gmail.com> wrote:
>
>     this.adapter.select('.cancel').each(function(elem) {

Gabriele Tassoni

unread,
Apr 3, 2008, 8:41:59 AM4/3/08
to ActiveScaffold : Ruby on Rails plugin
Seems not to fix the issue to me... I can't understand why, but
changing the js file at line 266 in public/javascript , made no
difference at all... hmmm! Caching problem, I'll look at it!

broox

unread,
Apr 8, 2008, 5:47:01 PM4/8/08
to ActiveScaffold : Ruby on Rails plugin
You rule. Good find.

On Mar 25, 8:53 am, AkitaOnRails <fabioak...@gmail.com> wrote:
> Ok, I figured out the problem.
>
> On active_scaffold.js (make sure you're looking at the copy on your
> public/javascript folder), around line #266 there is this code:
>
> this.adapter.getElementsByClassName('cancel').each(function(elem) {
>
> The guys at caboose (http://blog.caboo.se/articles/2008/3/21/safari-3-1-breaks-your-app) figured out that bothSafariand Firefox
> implements a new getElementsByClassName() function that breaks
> compatibility. The solution (there are variants) is this:
>
> this.adapter.select('.cancel').each(function(elem) {
>
> In this case I am replacing with Prototype's select() mechanism. This
> worked for me onSafari3.1.
>
> On Mar 24, 9:13 pm, David Richardson <david.richard...@channel200.net>
> wrote:
>
> > I'm having a tough time seeing whats going on with '.link'. Anyone
> > else?
> > It's a problem in update.rjstoo. Are 'cancel' links used anywhere
> > else?
>
> > This is somewhat important.Safari3.1 is out and Firefox 3 is weeks
> > away.
>
> > david

MZBP...@gmail.com

unread,
Apr 18, 2008, 4:26:09 PM4/18/08
to ActiveScaffold : Ruby on Rails plugin
Why hasn't the trunk been updated yet. It's been a month and I'm
getting irritated fixing this problem for each app. Do we need to
submit a bug report to the project leaders?

Jose Fernandez

unread,
Apr 18, 2008, 4:31:59 PM4/18/08
to actives...@googlegroups.com
http://github.com/edwinmoss/activescaffold/tree/master

Should be fixed here (i think). Otherwise you can fork the rep and
make your own fixed copy, thats what im about to do now.

Jose

Jose Fernandez

unread,
Apr 18, 2008, 7:50:06 PM4/18/08
to ActiveScaffold : Ruby on Rails plugin
http://github.com/jfernandez/activescaffold/tree/master

my fork with the fix, already sent a pull request

On Apr 18, 3:31 pm, Jose Fernandez <fernandez.joser...@gmail.com>
wrote:
> http://github.com/edwinmoss/activescaffold/tree/master
>
> Should be fixed here (i think).  Otherwise you can fork the rep and  
> make your own fixed copy, thats what im about to do now.
>
> Jose
>

Sonar

unread,
Apr 20, 2008, 1:49:40 PM4/20/08
to ActiveScaffold : Ruby on Rails plugin

RJS error (the same as described above or a new one, reappeared in
Safari 3.1.1)

David Herman

unread,
Apr 21, 2008, 12:47:42 AM4/21/08
to ActiveScaffold : Ruby on Rails plugin
I'm also getting this in FF 3b5

On Apr 20, 1:49 pm, Sonar <serp...@gmail.com> wrote:
> RJSerror(the same as described above or a new one, reappeared inSafari3.1.1)

chetanm

unread,
Apr 21, 2008, 7:23:25 AM4/21/08
to ActiveScaffold : Ruby on Rails plugin
yes !! even I get RJS errors in FF3b5 and Safari3.1

goodwill

unread,
May 9, 2008, 11:45:39 AM5/9/08
to ActiveScaffold : Ruby on Rails plugin
Second to this. It doesnt work on Safari 3.1, even changing row 266 to
select doesnt work. It fixed the problem on failed create (with
validation failure) but fails again on a successful create! Help.....

goodwill

unread,
May 10, 2008, 9:40:33 AM5/10/08
to ActiveScaffold : Ruby on Rails plugin
I want to know if there is anyone have clues on how to fix this?
Otherwise I am just not comfortable to use active_scaffold for now...
Message has been deleted

goodwill

unread,
May 10, 2008, 11:29:04 PM5/10/08
to ActiveScaffold : Ruby on Rails plugin
oh really, can be installed via script/plugin?

On May 11, 3:05 am, S <webi...@gmail.com> wrote:
> The latest version from github fixes this error.
>
> On May 10, 2008, at 9:40 AM, goodwill <william.yeung...@gmail.com>  

goodwill

unread,
May 10, 2008, 11:36:34 PM5/10/08
to ActiveScaffold : Ruby on Rails plugin
I should say I am completely new on git- how could I install the
plugin from there? if I just download the gz file, is there any method
to install that directly via the download without creating my own svn
store?
Message has been deleted

William Yeung

unread,
May 11, 2008, 12:05:47 AM5/11/08
to actives...@googlegroups.com
No I know what you are talking about, that doesnt fix the issue. I
have added comments on the issue in google code:

http://code.google.com/p/activescaffold/issues/detail?id=553&q=RJS

my comment is william.yeung.hk


On 11 May 2008, at 11:55 AM, S wrote:

>
> You just have to change a line of javascript. You can compare the last
> two changes to see the difference. This might just be the line 266
> change. It fixed the rjs error in ie7. I have not verified it in
> safari.
>
>
>
> On May 10, 2008, at 11:36 PM, goodwill <william....@gmail.com>

Radosław Bułat

unread,
May 13, 2008, 9:56:15 AM5/13/08
to actives...@googlegroups.com
I can confirm this issue. I've tried two earlier mentioned AS versions
from github and also change manually javascript files but no success.
$$("#admin__admins-update-2-form a.cancel").first().link return
undefined value. I wonder if .link is attribute introduced by "pure"
javascript, prototype or just active scaffold js? I found one place
where value is set to .link attribute. It's in function
register_cancel_hooks:

register_cancel_hooks: function() {
// anything in the insert with a class of cancel gets the closer
method, and a reference to this object for good measure
var self = this;
this.adapter.select('.cancel').each(function(elem) {
elem.observe('click', this.close_handler.bind(this));
elem.link = self;
}.bind(this))
},

It looks like .link is some helper attribute used only by AS but isn't
properly set. Can anyone fix it please?

--
Radosław Bułat

http://radarek.jogger.pl - mój blog

Carlos Puchol

unread,
May 13, 2008, 2:08:23 PM5/13/08
to actives...@googlegroups.com
Same thing happens with Firefox 3.0b5
(but not on Safari.3.0.4).

-c
ps: Sorry if this has been reported - I followed this thread late.

bjer

unread,
May 18, 2008, 4:18:12 PM5/18/08
to ActiveScaffold : Ruby on Rails plugin
Replacing:
this.adapter.getElementsByClassName('cancel').each(function(elem)
{
with this line
this.adapter.select('.cancel').each(function(elem) {
in /public/javascripts/active_scaffold/default/active_scaffold.js
and
/vendor/plugins/active_scaffold/frontends/default/javascripts/
active_scaffold.js
as suggested by derek.broox (http://code.google.com/p/activescaffold/
issues/detail?id=553&q=RJS)
fixed this issue for me (Safari 3.1.1, FF 3.0b5). Have not tried with
any advanced or custom forms yet...




On May 11, 6:05 am, William Yeung <william.yeung...@gmail.com> wrote:
> No I know what you are talking about, that doesnt fix the issue. I  
> have added comments on the issue in google code:
>
> http://code.google.com/p/activescaffold/issues/detail?id=553&q=RJS
>
> my comment is william.yeung.hk
>
> On 11 May 2008, at 11:55 AM, S wrote:
>
>
>
> > You just have to change a line of javascript. You can compare the last
> > two changes to see the difference.  This might just be the line 266
> > change. It fixed the rjs error in ie7. I have not verified it in  
> >safari.
>
> > On May 10, 2008, at 11:36 PM, goodwill <william.yeung...@gmail.com>
> > wrote:
>
> >> I should say I am completely new on git- how could I install the
> >> plugin from there? if I just download the gz file, is there any  
> >> method
> >> to install that directly via the download without creating my own svn
> >> store?
>
> >> On May 11, 11:29 am, goodwill <william.yeung...@gmail.com> wrote:
> >>> oh really, can be installed via script/plugin?
>
> >>> On May 11, 3:05 am, S <webi...@gmail.com> wrote:
>
> >>>> The latest version from github fixes this error.
>
> >>>> On May 10, 2008, at 9:40 AM, goodwill <william.yeung...@gmail.com>
> >>>> wrote:
>
> >>>>> I want to know if there is anyone have clues on how to fix this?
> >>>>> Otherwise I am just not comfortable to use active_scaffold for
> >>>>> now...
>
> >>>>> On May 9, 11:45 pm, goodwill <william.yeung...@gmail.com> wrote:
> >>>>>> Second to this. It doesnt work onSafari3.1, even changing row

talknightlife

unread,
Jun 7, 2008, 5:58:49 PM6/7/08
to ActiveScaffold : Ruby on Rails plugin
This still hasn't been fixed? I just grabbed the 1.1.1 Active
Scaffold release and also the May 31 release linked from the blog,
both of them still include the incompatibility with Safari and
Firefox.

I don't have a problem hacking in a fix every time I start a new
project, I just feel bad for new Active Scaffold users who believe
what the web site says, "Guaranteed to work on Firefox 1+, IE 6+ and
Safari 2+". I feel terrible for any newbies who just discovered
Active Scaffold in the last month or two. Anybody in the last month
or two who tried Active Scaffold probably just decided that it was too
buggy to use, not realizing that there was a one-line fix.
Reply all
Reply to author
Forward
0 new messages