Checkboxes are being checked before click handler is even called

前端 未结 2 1383
名媛妹妹
名媛妹妹 2021-01-15 13:47

I have the following snippets: http://jsfiddle.net/L7rne/5/ and http://jsfiddle.net/L7rne/6/

It turns out that if you pause execution of the script in the click even

2条回答
  •  情话喂你
    2021-01-15 14:10

    By time the event handler fires, the event has already taken place, and the browser is re-rendering in response. If the handler gets suspended, then the browser completes the work because nothing prevented it.

    Its like calling the police to a bank robbery, and they are in a traffic accident on the way. The robbers get away. The deed is done.

提交回复
热议问题