[Proto-Scripty] Re: Event.observe working in Firefox but not IE6-7

2008-10-30 Thread kangax

On Oct 30, 11:32 am, Dave <[EMAIL PROTECTED]> wrote:
> Thanks kangax,
>
> I tried renaming the names as you suggested but it's still the same
> thing. In Firefox it works, in IE it doesn't.  If I change the
> following line:
>
> Event.observe('events', 'change', function (e) {
>
> To observe one of the input elements instead
>
> Event.observe('event1', 'change', function (e) {
>
> It works in both IE and Firefox.  Upon some further reading I found
> from this document:
>
> http://www.w3.org/TR/DOM-Level-2-Events/events.html
>
> That it looks like "change" isn't valid for ol elements.  So shame on
> Firefox I guess? I'll try observing the form and update the event
> details when it's submitted, hopefully that will work.

Well, "change" event is only valid for INPUT, SELECT, and TEXTAREA
elements. It should also bubble (probably that's why it's caught on OL
element). I'm not sure why IE doesn't like this.

[snip]

-- kangax
--~--~-~--~~~---~--~~
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: Event.observe working in Firefox but not IE6-7

2008-10-30 Thread Dave

Thanks kangax,

I tried renaming the names as you suggested but it's still the same
thing. In Firefox it works, in IE it doesn't.  If I change the
following line:

Event.observe('events', 'change', function (e) {

To observe one of the input elements instead

Event.observe('event1', 'change', function (e) {

It works in both IE and Firefox.  Upon some further reading I found
from this document:

http://www.w3.org/TR/DOM-Level-2-Events/events.html

That it looks like "change" isn't valid for ol elements.  So shame on
Firefox I guess? I'll try observing the form and update the event
details when it's submitted, hopefully that will work.

On Oct 29, 5:16 pm, kangax <[EMAIL PROTECTED]> wrote:
> On Oct 29, 4:01 pm, Dave <[EMAIL PROTECTED]> wrote:
>
>
>
> > As the subject says I have the follow js:
>
> > 
> >Event.observe('events', 'change', function (e) {
> >   new Ajax.Updater('event_details',
> >                    'URL',
> >                    { method: 'post',
> >                      parameters: 'event=' +
> > e.element().id.gsub('event', '') });});
>
> > 
>
> > This is working inFirefoxbut notIE.  I'm kind of at a loss as to
> > why it's not working. Taking a guess, maybe it has something to do
> > with whatIEconsiders a "change" to  the ol #events:
>
> > 
> > 
> >   
> >     Event1
> >   
>
> "event" is a pretty dangerous name to choose [1] : )
>
> Browsers happen to do quite stupid things with named controls - e.g.
> shadowing same-named global variables. In this case,IE'sglobal
> `event` (which actually referenceseventobject wheneventoccurs) is
> most likely shadowed with this input element. This means that `e' is
> resolved to an element (rather than aneventobject) and so everything
> sort of messes up.
>
> Try to "namespace" those names - e.g. use something like "foo-uname",
> "foo-password", etc. and see if the problem still exists.
>
> [snip]
>
> [1]http://jibbering.com/faq/names/
>
> --
> kangax
--~--~-~--~~~---~--~~
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: Event.observe working in Firefox but not IE6-7

2008-10-29 Thread kangax

On Oct 29, 4:01 pm, Dave <[EMAIL PROTECTED]> wrote:
> As the subject says I have the follow js:
>
> 
> Event.observe('events', 'change', function (e) {
>   new Ajax.Updater('event_details',
>                    'URL',
>                    { method: 'post',
>                      parameters: 'event=' +
> e.element().id.gsub('event', '') });});
>
> 
>
> This is working in Firefox but not IE.  I'm kind of at a loss as to
> why it's not working. Taking a guess, maybe it has something to do
> with what IE considers a "change" to  the ol #events:
>
> 
> 
>   
>     Event 1
>   

"event" is a pretty dangerous name to choose [1] : )

Browsers happen to do quite stupid things with named controls - e.g.
shadowing same-named global variables. In this case, IE's global
`event` (which actually references event object when event occurs) is
most likely shadowed with this input element. This means that `e' is
resolved to an element (rather than an event object) and so everything
sort of messes up.

Try to "namespace" those names - e.g. use something like "foo-uname",
"foo-password", etc. and see if the problem still exists.

[snip]

[1] http://jibbering.com/faq/names/

--
kangax
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---