[Proto-Scripty] Re: IE6 Error: Object doesn't support this property or method

2008-12-02 Thread T.J. Crowder

Hi,

  1. 90% of the time, you'll figure out what's wrong in the process of
  doing it -- instant help!

 Bingo!

Cool. :-)

 So I worked out that it is because of this:
 ...
 Though, changing to what I logically would have thought it should be
 hasn't worked

IE is not tolerant of trailing commas in object and array literals
(e.g., [1, 2, ] instead of [1, 2]), so it won't like the original
addBehavior code you quoted.  Other browsers' JavaScript parsers are
more forgiving (although technically the trailing comma is wrong in
the current version of JavaScript; Crockford and others are trying to
get it put in the next ECMAScript spec though[1], and I think they've
succeeded as of the latest 3.1 draft[2]).

[1] http://javascript.crockford.com/recommend.html
[2] http://wiki.ecmascript.org/doku.php?id=es3.1:es3.1_proposal_working_draft

So just drop the comma after the function definition:

Event.addBehavior({
'.collapse:click' : function(e) {
var div = this.id;
new Effect.toggle(div + '-block','blind', {queue:
'end', duration: 0.5});
} // == No comma

});

The problem with the replacement code you listed is that you're
calling observe() on an array [the return value of $$()].  observe()
is a method Prototype adds to elements, not arrays.  You could get
what you were looking for via Enumerable#invoke()[3] (Enumerable is
mixed into arrays), but just deleting the comma should be all you
need.

[3] http://www.prototypejs.org/api/enumerable/invoke

HTH,
--
T.J. Crowder
tj / crowder software / com

On Dec 1, 11:39 pm, Grant Newton [EMAIL PROTECTED] wrote:
  1. 90% of the time, you'll figure out what's wrong in the process of  
  doing it -- instant help!

 Bingo!

 So I worked out that it is because of this:

 Event.addBehavior({
         '.collapse:click' : function(e) {
                 var div = this.id;
                 new Effect.toggle(div + '-block','blind', {queue: 'end', 
 duration:  
 0.5});
         },

 });

 Though, changing to what I logically would have thought it should be  
 hasn't worked:

         $$('.collapse').observe('click', function() {
                 var div = this.id;
                 new Effect.toggle(div + '-block','blind', {queue: 'end', 
 duration:  
 0.5});
         });

 Suggestions?

 Grant

 On 01/12/2008, at 9:06 PM, T.J. Crowder wrote:



  Hi Grant,

  And even after copy/paste of your code, I still get the error.

  You would do; as I said, the problem isn't in the code you quoted, so
  my changes to it don't matter other than removing an unnecessary call.

  An example of where I have it in use is:

  Sorry, it's just not practical for other people to go digging around
  the full version.  Again:  Can you create a _small, self-contained
  page_ that demonstrates the problem.  There are two reasons for doing
  this:  1. 90% of the time, you'll figure out what's wrong in the
  process of doing it -- instant help!  2. If not, it gives people
  trying to help you out a small, simple example of the problem.
  --
  T.J. Crowder
  tj / crowder software / com

  On Dec 1, 5:51 am, Grant Newton [EMAIL PROTECTED] wrote:
  Thanks TJ

  An example of where I have it in use is:

         http://www.sydneycommunitycollege.com.au/courses/sport/dance

  And even after copy/paste of your code, I still get the error.

  Thanks

  Grant

  On 01/12/2008, at 4:35 PM, T.J. Crowder wrote:

  Hi Grant,

  You only need $() to extend elements that have not already been
  extended.  $$() extends the elements it returns[1].  Also, the only
  reason to call $() is if you're doing something with the return  
  value,
  which in the given code you're not.

  [1]http://prototypejs.org/api/utility/dollar

  Your code doesn't cause an error at my end in IE6 (and does hide the
  relevant bits), but again, you dont need the $() call, so you can do
  this instead:

  document.observe('dom:loaded', function() {
     $$('.blockbody').invoke('hide');
     $$('.hint').invoke('hide');
     $$('.reason').invoke('hide');
  });

  The problem must lie elsewhere.  Can you create a small, self-
  contained page that demonstrates the problem and poast it to Pastie?
  Along the way you may figure out the problem, and if not, it'll give
  the folks here something complete to help you with.

  HTH,
  --
  T.J. Crowder
  tj / crowder software / com

  On Dec 1, 12:33 am, grant [EMAIL PROTECTED] wrote:
  Hello all

  I am having a little trouble with IE6 and this snippet of code:

          document.observe('dom:loaded', function() {
                  $(
                          $$('.blockbody').invoke('hide'),
                          $$('.hint').invoke('hide'),
                          $$('.reason').invoke('hide')
                  );
          });

  I've done some searching to try and work out why I am receiving the
  error:

          Object doesn't support this property or method

  Wiki docs suggest wrapping with $(), though I don't think I have  
  done
  that 

[Proto-Scripty] Re: IE6 Error: Object doesn't support this property or method

2008-11-30 Thread T.J. Crowder

Hi Grant,

You only need $() to extend elements that have not already been
extended.  $$() extends the elements it returns[1].  Also, the only
reason to call $() is if you're doing something with the return value,
which in the given code you're not.

[1] http://prototypejs.org/api/utility/dollar

Your code doesn't cause an error at my end in IE6 (and does hide the
relevant bits), but again, you dont need the $() call, so you can do
this instead:

document.observe('dom:loaded', function() {
$$('.blockbody').invoke('hide');
$$('.hint').invoke('hide');
$$('.reason').invoke('hide');
});

The problem must lie elsewhere.  Can you create a small, self-
contained page that demonstrates the problem and poast it to Pastie?
Along the way you may figure out the problem, and if not, it'll give
the folks here something complete to help you with.

HTH,
--
T.J. Crowder
tj / crowder software / com

On Dec 1, 12:33 am, grant [EMAIL PROTECTED] wrote:
 Hello all

 I am having a little trouble with IE6 and this snippet of code:

         document.observe('dom:loaded', function() {
                 $(
                         $$('.blockbody').invoke('hide'),
                         $$('.hint').invoke('hide'),
                         $$('.reason').invoke('hide')
                 );
         });

 I've done some searching to try and work out why I am receiving the
 error:

         Object doesn't support this property or method

 Wiki docs suggest wrapping with $(), though I don't think I have done
 that properly. Any help is much appreciated.

 Grant
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@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-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: IE6 Error: Object doesn't support this property or method

2008-11-30 Thread Grant Newton

Thanks TJ

An example of where I have it in use is:

http://www.sydneycommunitycollege.com.au/courses/sport/dance

And even after copy/paste of your code, I still get the error.

Thanks

Grant

On 01/12/2008, at 4:35 PM, T.J. Crowder wrote:


 Hi Grant,

 You only need $() to extend elements that have not already been
 extended.  $$() extends the elements it returns[1].  Also, the only
 reason to call $() is if you're doing something with the return value,
 which in the given code you're not.

 [1] http://prototypejs.org/api/utility/dollar

 Your code doesn't cause an error at my end in IE6 (and does hide the
 relevant bits), but again, you dont need the $() call, so you can do
 this instead:

 document.observe('dom:loaded', function() {
$$('.blockbody').invoke('hide');
$$('.hint').invoke('hide');
$$('.reason').invoke('hide');
 });

 The problem must lie elsewhere.  Can you create a small, self-
 contained page that demonstrates the problem and poast it to Pastie?
 Along the way you may figure out the problem, and if not, it'll give
 the folks here something complete to help you with.

 HTH,
 --
 T.J. Crowder
 tj / crowder software / com

 On Dec 1, 12:33 am, grant [EMAIL PROTECTED] wrote:
 Hello all

 I am having a little trouble with IE6 and this snippet of code:

 document.observe('dom:loaded', function() {
 $(
 $$('.blockbody').invoke('hide'),
 $$('.hint').invoke('hide'),
 $$('.reason').invoke('hide')
 );
 });

 I've done some searching to try and work out why I am receiving the
 error:

 Object doesn't support this property or method

 Wiki docs suggest wrapping with $(), though I don't think I have done
 that properly. Any help is much appreciated.

 Grant
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@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-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: IE6 Error

2008-10-21 Thread T.J. Crowder

Hi John,

This usually happens when you try to call a Prototype method on an
Element instance that hasn't been extended [passed through $()].  On
almost everything but IE, that's fine, but on IE you have to be sure
to pass the instance through $().

There's an article on this in the new unofficial Prototype 
script.aculo.us wiki, in the Troubleshooting section:
http://proto-scripty.wikidot.com/prototype:object-doesn-t-support-this-property-or-method

If you give that a quick read and then look at your application code
that's calling into Prototype when the error occurs, you'll probably
see where the missing $() should go.

More about the general topic of extending elements here:
http://www.prototypejs.org/learn/extensions

HTH,
--
T.J. Crowder
tj / crowder software / com

On Oct 20, 11:57 pm, jschank [EMAIL PROTECTED] wrote:
 Hello,

 I'm using protoype.js in a rails application. The application works
 fine on Safari, FireFox (both windows and mac), however, when I load
 my app in IE6, I get an Error: Object doesn't support this property
 or method pop up.

 When I choose to debug that in the script debugger, I see that the
 error is on the line which says element.fireEvent(event.eventType,
 event); which seems to be in a method with a fire: symbol at the
 beginning. (I'm not a javascript guru, I don't recognize that syntax)

 I've tried getting 1.6.0.3 from the web site, and also tried getting
 the latest from github, and building it and deploying that. Still the
 problem persists.

 Does anyone have any idea of how to handle this?

 Thanks,
 John Schank
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@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-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: IE6 Error

2008-10-21 Thread jschank

Hi T.J.
Thanks for the reply.

I've read the docs at the links you mention, but I'm still stuck.
The problem (with me anyway) is that I'm a JavaScript noob, and the
JavaScript calls that exist in my app get there via Rails. So I'm
having a problem even finding the offending function.

It seems to me that the call that is failing - the dom:loaded event
is one that is set up automatically as part of using Rails. Does this
sound likely?
If so, do you have any ideas where I might be looking in my code. The
only javascript that I explicitly created uses jQuery and as far as I
can tell already wraps the access to elements in the $() as
recommended. And doesn't have anything to do with document loading.

Thanks,
John
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@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-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: IE6 Error

2008-10-21 Thread jschank

T.J.

I thought I'd add the clip of the only JavaScript code that I'm
responsible for: (in case the problem is therein)

$(document).ready(function()
{
// Build tabs...
$('#tabs  ul').tabs({ fx: { height: 'toggle', opacity:
'toggle' } });

// Animate the hiding of any flash elements...
  $(div.flash).show(drop, { direction: up}, 1000);
setTimeout( function(){$(div.flash).hide(scale, {}, 1000);},
5000);
});

I'm certainly fine with digging into the Rails code to fix the
problem, if it is there, I just don't have enough experience with
Rails to know where to look.
I think I'll try commenting out my javascript code, and see if
deployment still fails on IE6. That should help nail down where the
code is that needs to be fixed. (mine - or something I've inherited
from Rails, or one of the plugins I'm using)

Thanks again,
John
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@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-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: IE6 Error

2008-10-21 Thread jschank

T.J.

I did the remove of my JavaScript, and I still get the error.
So it must be a problem with Rails or one of the plugins.
I'll poke around on their boards and fora to see if they have mention
of this.

Thanks,
John
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@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-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: IE6 Error

2008-10-21 Thread jschank

Ok, I've solved this...

Apparently, the problem stems from trying to use both prototype AND
jQuery on the same page. I thought I needed prototype for
active_scaffold (AS does require prototype) but I was able to remove
both active_scaffold and prototype from my app.

Now I no longer get the Object doesn't support... error in IE6.

Of course, this being IE6, I now get a different error in swfobject.js
for my charts.

Funny how Safari and FF don't have these problems.

Thanks for the help T.J.

John
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@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-scriptaculous?hl=en
-~--~~~~--~~--~--~---