Interruption of JavaScript functions execution -


i have html page javascript:

<!doctype html>      <html>          <head>             <script>                 function dowork() {                      console.log("\tdowork-start");                      var = new date();                      var end = now.gettime() + 2000;                      while(now < end) {                         = new date();                      }                      console.log("\tdowork-end");                 }                  function handleonclick() {                     console.log("onclick-start");                     console.log("onclick-end");                 }                  function handleonchange() {                     console.log("onchange-start");                     window.open('', 'name', 'height=300,width=600,top=200,left=200');                     dowork();                     console.log("onchange-end");                 }             </script>         </head>          <body>             <form>                 <input type="text" onchange="handleonchange();">                 <input type="button" value="ok" onclick="handleonclick();">             </form>          </body>      </html> 

use case: enter value in input control , click button. expect such logs in console:

onchange-start     dowork-start     dowork-end onchange-end onclick-start onclick-end 

but in firefox i've got:

onchange-start onclick-start onclick-end     dowork-start     dowork-end onchange-end 

notice, onclick execution interrupts onchange execution. function dowork emulates long work. in chrome works expected.

can explain how possible?


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -