Code, Shiny Things, and Other Random Shit I Like

jamesreinknecht.com

I might not need jquery?! Lies.

After spending 2 hours trying to shoehorn jQuery into the Magic Mirror project I’m tinkering with, and failing miserably, I’m going to call it a game. It’s time i go back to basics and do some Vanilla JavaScript DOM manipulation.

WHYYYYYYY!@?#>@#>@! OH GOD WHY IS IT SO PAINFUL!??? IS THIS HOW PEOPLE WROTE JAVASCRIPT DURING WORLD WAR 1?!?!?!

jquery

I can’t chain things together! Everything looks ugly and makes me hate it. If you try and chain stuff together, weird things happen.

Horse And Buggy:


1
2
3
var sunriseSunsetTxt = document.createElement("div")
sunriseSunsetTxt.className = "col-xs-1 p-2 m-2"
sunriseSunsetTxt.innerHTML = this.sunriseSunsetTime;

Twin Turbos:

1
var sunriseSunsetTxt = $('<div>').addClass("col-xs-1 p-2 m-2").text(this.sunriseSunsetTime)

javaScript really needs the set/get abilities of jQuery without screwing with state so much. Honestly though its not really entirely necessary in things like React, etc, but for little one off projects where you REALLY want to write fast, clean and accurate, why can’t vanilla JS at least learn SOMETHING from a library that EVERYONE uses?

Here’s a handy site though for whenever you HAVE to horse and buggy this shit right back to the 1800s:

http://youmightnotneedjquery.com/