Jonas Rosenqvist
2008-Feb-19 10:07 UTC
IE bug: Invoke does not pass along "this" in invoke arguments
It''s not the prettiest of codes but it should work, mind you I have
not included the full script but this is the active part that fails in
IE (tested in version 7), the script invokes a setStyle on another
group of divs without any reference to "this".
Oh and it works flawlessly in both firefox and safari.
Element.addMethods({
manglethumb: function(elem) {
alert(typeof( elem ));
return false;
}
});
$$(''div.cbx'').invoke(''manglethumb'',{elem:this});
I''ve tried a lot of different ways to make this work, all failed.
Found some info about IE not allowing scripts to extend Element, but
that shouldnt matter with prototype right? Debugging this is way above
my javascript skillset =)
Temporarily I''m using a plain old for-loop, and that works like a
charm.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Manu Temmerman-Uyttenbroeck
2008-Feb-19 11:07 UTC
Re: IE bug: Invoke does not pass along "this" in invoke arguments
Did you try this:
$$(''div.cbx'').invoke(''manglethumb''); ?
I think it automatically passes in the element as first argument..
On Feb 19, 2008 11:07 AM, Jonas Rosenqvist
<jonrqv-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> It''s not the prettiest of codes but it should work, mind you I
have
> not included the full script but this is the active part that fails in
> IE (tested in version 7), the script invokes a setStyle on another
> group of divs without any reference to "this".
>
> Oh and it works flawlessly in both firefox and safari.
>
> Element.addMethods({
> manglethumb: function(elem) {
> alert(typeof( elem ));
> return false;
> }
> });
>
>
$$(''div.cbx'').invoke(''manglethumb'',{elem:this});
>
> I''ve tried a lot of different ways to make this work, all failed.
> Found some info about IE not allowing scripts to extend Element, but
> that shouldnt matter with prototype right? Debugging this is way above
> my javascript skillset =)
>
> Temporarily I''m using a plain old for-loop, and that works like a
> charm.
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Tobie Langel
2008-Feb-19 12:41 UTC
Re: IE bug: Invoke does not pass along "this" in invoke arguments
Try this:
Element.addMethods({
manglethumb: function(element) {
alert(element.inspect());
}
});
$$(''div.cbx'').invoke(''manglethumb'');
Best,
Tobie
On Feb 19, 12:07 pm, "Manu Temmerman-Uyttenbroeck"
<manu.temmermanuyttenbro...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Did you try this:
$$(''div.cbx'').invoke(''manglethumb''); ?
> I think it automatically passes in the element as first argument..
>
> On Feb 19, 2008 11:07 AM, Jonas Rosenqvist
<jon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > It''s not the prettiest of codes but it should work, mind you
I have
> > not included the full script but this is the active part that fails in
> > IE (tested in version 7), the script invokes a setStyle on another
> > group of divs without any reference to "this".
>
> > Oh and it works flawlessly in both firefox and safari.
>
> > Element.addMethods({
> > manglethumb: function(elem) {
> > alert(typeof( elem ));
> > return false;
> > }
> > });
>
> >
$$(''div.cbx'').invoke(''manglethumb'',{elem:this});
>
> > I''ve tried a lot of different ways to make this work, all
failed.
> > Found some info about IE not allowing scripts to extend Element, but
> > that shouldnt matter with prototype right? Debugging this is way above
> > my javascript skillset =)
>
> > Temporarily I''m using a plain old for-loop, and that works
like a
> > charm.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Jonas Rosenqvist
2008-Feb-19 15:32 UTC
Re: IE bug: Invoke does not pass along "this" in invoke arguments
Yes I''ve tried that one, didnt work.. breaks FF and safari too :) On 19 Feb, 12:07, "Manu Temmerman-Uyttenbroeck" <manu.temmermanuyttenbro...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Did you try this: $$(''div.cbx'').invoke(''manglethumb''); ? > I think it automatically passes in the element as first argument.. > > On Feb 19, 2008 11:07 AM, Jonas Rosenqvist <jon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > It''s not the prettiest of codes but it should work, mind you I have > > not included the full script but this is the active part that fails in > > IE (tested in version 7), the script invokes a setStyle on another > > group of divs without any reference to "this". > > > Oh and it works flawlessly in both firefox and safari. > > > Element.addMethods({ > > manglethumb: function(elem) { > > alert(typeof( elem )); > > return false; > > } > > }); > > > $$(''div.cbx'').invoke(''manglethumb'',{elem:this}); > > > I''ve tried a lot of different ways to make this work, all failed. > > Found some info about IE not allowing scripts to extend Element, but > > that shouldnt matter with prototype right? Debugging this is way above > > my javascript skillset =) > > > Temporarily I''m using a plain old for-loop, and that works like a > > charm.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Jonas Rosenqvist
2008-Feb-19 15:43 UTC
Re: IE bug: Invoke does not pass along "this" in invoke arguments
I think it breaks before it even reaches the added method function, same error and same breakpoint. Firefox and safari nicely spams all the div declarations. I also tried to add .bind(this) on the manglethumb function, broke firefox and safari, IE still sucks. On 19 Feb, 13:41, Tobie Langel <tobie.lan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Try this: > > Element.addMethods({ > manglethumb: function(element) { > alert(element.inspect()); > } > > }); > > $$(''div.cbx'').invoke(''manglethumb''); > > Best, > > Tobie > > On Feb 19, 12:07 pm, "Manu Temmerman-Uyttenbroeck" > > <manu.temmermanuyttenbro...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Did you try this: $$(''div.cbx'').invoke(''manglethumb''); ? > > I think it automatically passes in the element as first argument.. > > > On Feb 19, 2008 11:07 AM, Jonas Rosenqvist <jon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > It''s not the prettiest of codes but it should work, mind you I have > > > not included the full script but this is the active part that fails in > > > IE (tested in version 7), the script invokes a setStyle on another > > > group of divs without any reference to "this". > > > > Oh and it works flawlessly in both firefox and safari. > > > > Element.addMethods({ > > > manglethumb: function(elem) { > > > alert(typeof( elem )); > > > return false; > > > } > > > }); > > > > $$(''div.cbx'').invoke(''manglethumb'',{elem:this}); > > > > I''ve tried a lot of different ways to make this work, all failed. > > > Found some info about IE not allowing scripts to extend Element, but > > > that shouldnt matter with prototype right? Debugging this is way above > > > my javascript skillset =) > > > > Temporarily I''m using a plain old for-loop, and that works like a > > > charm.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Tobie Langel
2008-Feb-19 15:48 UTC
Re: IE bug: Invoke does not pass along "this" in invoke arguments
Works for me. Which version of Prototype are you using ? On Feb 19, 4:43 pm, Jonas Rosenqvist <jon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I think it breaks before it even reaches the added method function, > same error and same breakpoint. > Firefox and safari nicely spams all the div declarations. > > I also tried to add .bind(this) on the manglethumb function, broke > firefox and safari, IE still sucks. > > On 19 Feb, 13:41, Tobie Langel <tobie.lan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Try this: > > > Element.addMethods({ > > manglethumb: function(element) { > > alert(element.inspect()); > > } > > > }); > > > $$(''div.cbx'').invoke(''manglethumb''); > > > Best, > > > Tobie > > > On Feb 19, 12:07 pm, "Manu Temmerman-Uyttenbroeck" > > > <manu.temmermanuyttenbro...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Did you try this: $$(''div.cbx'').invoke(''manglethumb''); ? > > > I think it automatically passes in the element as first argument.. > > > > On Feb 19, 2008 11:07 AM, Jonas Rosenqvist <jon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > It''s not the prettiest of codes but it should work, mind you I have > > > > not included the full script but this is the active part that fails in > > > > IE (tested in version 7), the script invokes a setStyle on another > > > > group of divs without any reference to "this". > > > > > Oh and it works flawlessly in both firefox and safari. > > > > > Element.addMethods({ > > > > manglethumb: function(elem) { > > > > alert(typeof( elem )); > > > > return false; > > > > } > > > > }); > > > > > $$(''div.cbx'').invoke(''manglethumb'',{elem:this}); > > > > > I''ve tried a lot of different ways to make this work, all failed. > > > > Found some info about IE not allowing scripts to extend Element, but > > > > that shouldnt matter with prototype right? Debugging this is way above > > > > my javascript skillset =) > > > > > Temporarily I''m using a plain old for-loop, and that works like a > > > > charm.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Jonas Rosenqvist
2008-Feb-21 08:19 UTC
Re: IE bug: Invoke does not pass along "this" in invoke arguments
You''re right it works on it''s own, in all browsers....
<html>
<head>
<title>test</title>
<script type="text/javascript"
src="prototype.js"></script>
</head>
<body>
<div id="tstdiv" class="cbx">testdiv</div>
<div id="tstdiv2" class="cbx">testdiv</div>
<script type="text/javascript">
document.observe(''dom:loaded'', function() {
Element.addMethods({
manglethumb: function(element) {
alert(element.inspect());
}
});
$$(''div.cbx'').invoke(''manglethumb'');
});
</script>
</body>
</html>
However when I run the exact same script in the application I''m
developing I.E. breaks.
I''m running invoke from a function and I''ve tried doing that
in the
standalone script and that did''nt matter either. And the divs
are''nt
dynamically generated or anything like that.
The group of divs has event handlers tied to them so maybe that''s
what''s causing problems? Oh and I''m using prototype 1.6.0.2.
Sorry if my english is hard to read, I''m from Sweden :)
Oh btw, prototype rocks! thanks for all the hard work you guy''s are
doing.
On 19 Feb, 16:48, Tobie Langel
<tobie.lan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Works for me.
>
> Which version of Prototype are you using ?
>
> On Feb 19, 4:43 pm, Jonas Rosenqvist
<jon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > I think it breaks before it even reaches the added method function,
> > same error and same breakpoint.
> > Firefox and safari nicely spams all the div declarations.
>
> > I also tried to add .bind(this) on the manglethumb function, broke
> > firefox and safari, IE still sucks.
>
> > On 19 Feb, 13:41, Tobie Langel
<tobie.lan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > Try this:
>
> > > Element.addMethods({
> > > manglethumb: function(element) {
> > > alert(element.inspect());
> > > }
>
> > > });
>
> > >
$$(''div.cbx'').invoke(''manglethumb'');
>
> > > Best,
>
> > > Tobie
>
> > > On Feb 19, 12:07 pm, "Manu Temmerman-Uyttenbroeck"
>
> > >
<manu.temmermanuyttenbro...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> > > > Did you try this:
$$(''div.cbx'').invoke(''manglethumb''); ?
> > > > I think it automatically passes in the element as first
argument..
>
> > > > On Feb 19, 2008 11:07 AM, Jonas Rosenqvist
<jon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > > > It''s not the prettiest of codes but it should
work, mind you I have
> > > > > not included the full script but this is the active
part that fails in
> > > > > IE (tested in version 7), the script invokes a setStyle
on another
> > > > > group of divs without any reference to
"this".
>
> > > > > Oh and it works flawlessly in both firefox and safari.
>
> > > > > Element.addMethods({
> > > > > manglethumb: function(elem) {
> > > > > alert(typeof( elem ));
> > > > > return false;
> > > > > }
> > > > > });
>
> > > > >
$$(''div.cbx'').invoke(''manglethumb'',{elem:this});
>
> > > > > I''ve tried a lot of different ways to make
this work, all failed.
> > > > > Found some info about IE not allowing scripts to extend
Element, but
> > > > > that shouldnt matter with prototype right? Debugging
this is way above
> > > > > my javascript skillset =)
>
> > > > > Temporarily I''m using a plain old for-loop,
and that works like a
> > > > > charm.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---