Skip to content
Advertisement

Should CSS always precede JavaScript?

In countless places online I have seen the recommendation to include CSS prior to JavaScript. The reasoning is generally, of this form: When it comes to ordering your CSS and JavaScript, you want your CSS to come first. The reason is that the rendering thread has all the style information it needs to render the page. If the JavaScript includes

Making sure I get a mouse up event for every mouse down

The code below draws a rectangle on every mouse move after the mouse button is pressed. When the user releases the mouse it should stop drawing. I am trying to figure out how to make sure that drawing stops if the user releases the mouse outside the canvas element. I thought that I could accomplish this by setting onmouseup event

Multiple websocket connections

Is there any advantages of having two distinct websocket connections to the same server from the same client? To me this seems a bad design choice, but is there any reason why/where it should work out better? Answer There are several reasons why you might want to do that but they probably aren’t too common (at least not yet): You

Advertisement