Wait until flag=true

Because javascript in a browser is single threaded (except for webworkers which aren’t involved here) and one thread of javascript execution runs to completion before another can run, your statement: will simply run forever (or until the browser complains about a non-responsive javascript loop), the page will appear to be hung and no other javascript … Read more

Fully responsive HTML5 video

Use width and max-height on the <video> element:  Run code snippetExpand snippet http://jsfiddle.net/fHG69/ Also, you’re missing a semicolon after background-color. When absolutely positioning an element to fill the screen, I prefer to set top, bottom, left, and right instead of setting height and width.

What is the non-jQuery equivalent of ‘$(document).ready()’?

This works perfectly, from ECMA. The snippet is all you need, but if you want to dig more and explore other options check this detailed explanation. The window.onload doesn’t equal to JQuery $(document).ready because $(document).ready waits only to the DOM tree while window.onload check all elements including external assets and images. EDIT: Added IE8 and older equivalent, thanks to Jan Derk‘s observation. You may read … Read more

stopPropagation vs. stopImmediatePropagation

stopPropagation will prevent any parent handlers from being executed stopImmediatePropagation will prevent any parent handlers and also any other handlers from executing Quick example from the jquery documentation: Note that the order of the event binding is important here! Show code snippet