Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31371

Re: event listener behavior different in ie chrome

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: event listener behavior different in ie chrome
Date 2016-09-14 15:00 +0100
Organization A noiseless patient Spider
Message-ID <87bmzqoa2h.fsf@bsb.me.uk> (permalink)
References <f56b7236-7009-4a5a-b50c-a8c8ff3f5769@googlegroups.com>

Show all headers | View raw


Andrew <andrew.m.levin.1@gmail.com> writes:

> I found that the following 
>
> add_message_form.addEventListener('submit', function (e) {
>                                                                                                                                                                           
> e.preventDefault();
>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
> add_message_form.submit();
>                                                                                                                                                                                                                                                                                                                               
> add_message_form.reset();
>
> }, false)

Why all the newlines and spaces?

> triggers different behavior in chrome and ie. In chrome the reset is
> performed before the submit and in ie the submit is performed before
> the reset. To me it seems that the ie behavior is the correct
> one. Does anyone understand what is going on?

Calling submit does not guarantee that the form's content will be
collected then and there.  What I suspect you are seeing is that the
form is submitted when the browser "has a moment" and this happens to be
after the reset has been done.

Whatever you are trying to do, you will have to find some other way to
do it.  What is the overall objective?

-- 
Ben.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

event listener behavior different in ie chrome Andrew <andrew.m.levin.1@gmail.com> - 2016-09-14 06:14 -0700
  Re: event listener behavior different in ie chrome Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-14 15:00 +0100
    Re: event listener behavior different in ie chrome Andrew <andrew.m.levin.1@gmail.com> - 2016-09-14 07:13 -0700
      Re: event listener behavior different in ie chrome Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-14 19:46 +0100
        Re: event listener behavior different in ie chrome Andrew <andrew.m.levin.1@gmail.com> - 2016-09-14 11:53 -0700
          Re: event listener behavior different in ie chrome Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-15 01:09 +0100
      Re: event listener behavior different in ie chrome Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2016-09-15 08:16 +0200

csiph-web