Better HN
topnewbestaskshowjobs
Log inSign up

bitwarrior

255 karma · joined Feb 11, 2013 (13y ago) · 64 submissions

Submissions

comment 12y ago · link · parent

Everything I see on Twitter is a kind of ad.

comment 12y ago · link · parent

I understand the desire for people to make pages like this (this isn't the first), but the examples are not completely honest with themselves, in my opinion.

One of the biggest benefits jQuery introduces is the concept of treating single selections and multiple selections identically. While using jQuery, I can emit a $(".class").hide() call, which will apply to all elements with the matching class. Simple and elegant.

However, using native JS as the page suggests, I will need to construct a loop within my function, especially if I'm using the DOM supported getElementsByClassName method, returns a pseudo-array of DOM nodes which don't have the style method available on them. You'll notice the examples already assume a selected element and leave much of this heavy lifting out.

Furthermore, jQuery offers the selection simplicities of Sizzle (ie: "#div .container .item). To do the same selection process in vanilla JS, I'll need to nest 2 getElementsByClassName functions in a getElementByID function, and return the concatenated results from each potential .container. That is to say nothing of more complex selectors.

So yes, if you're addressing the absolute simplest form of selection, this works, but otherwise I don't think it's really presenting the situation honestly.

comment 12y ago · link · parent

They're keeping emotions out of their startup, like guilt due to plagiarism.

64.

Debugging Javascript(jameslaicreative.com ↗)

1 points · by bitwarrior · 13y ago · discuss

123