JavaScript: Updating DOM properties during a callback

Viewed 53

When I update an .src in a Javascript .onclick callback, when is the image reloaded?

Does the browser fetch the image as soon as a new src is set, or does it only do it when the callback is finished?

Is this standardized somewhere?

This answer suggests that the DOM only updates after execution, but I'm not sure if this is generally true. Also, do browsers optimize this anyway in the background?

0 Answers
Related