JQUERY IS QUEER.

The neat thing about programming is that every language is roughly the same. Each come with different frameworks and plugins making accomplishing certain tasks easier in one language over the other. 

Javascript is the language of the web, but sometimes the logic is kinda stupid. Especially to someone who’s coming from Ruby. Here’s some queer shit that I found:

Manipulating Content

Data on websites are structured as a tree, which web guys refer to as the “DOM”. Every parent has children, and the children usually has siblings. Ordering matters, so the first child gets rendered (but not necessarily displayed) first. Now if you want to create siblings before “h1” you type in 

$(“h1”).before(“<h3></h3>”)

That reads “H1 before H3”, but in fact it’s “H3 is before H1”. Ruby guys would fix it as 

$(“h1”).is_after(“<h3></h3>”)

It’s subtle, but imagine thousands of lines of the “reading backwards” type logic above. It’s easier to write bad code.

So with “after” it's 

$(“h1”).after(“<h3></h3>”)

but should be:

$(“h1”).is_before(“<h3></h3>”)