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

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: event listener behavior different in ie chrome
Date Wed, 14 Sep 2016 15:00:38 +0100
Organization A noiseless patient Spider
Lines 31
Message-ID <87bmzqoa2h.fsf@bsb.me.uk> (permalink)
References <f56b7236-7009-4a5a-b50c-a8c8ff3f5769@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="7189"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bf9HH62Tprp5xkOfwTFT9hsxJTB2Or7w="
Cancel-Lock sha1:MyVZpvyuzvfSpdqgCVaquuiNECI= sha1:NUAFuGYroFTx5YIYo3Qe0Sgf/jU=
X-BSB-Auth 1.b3e39f7ed50c75a737f4.20160914150038BST.87bmzqoa2h.fsf@bsb.me.uk
Xref csiph.com comp.lang.javascript:31371

Show key headers only | 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