News for hackers. Stuff that matters.
Re:Removing jQuery from GitHub.com frontend by swah on Thursday July 26, 2018 @07:10AM (#17616503)
Another tweet says that removing chaining improved readability...

https://twitter.com/mislav/status/1022409388013834240

But this I'd say is very close to BS territory..

Re:Removing jQuery from GitHub.com frontend by lewisjoe on Thursday July 26, 2018 @07:55AM (#17616719)
It was me, who asked him the question. The answer though isn't satisfactory enough. But again 140 chars is not a good bandwidth for meaningful conversations.

The claim is interesting, but isn't evident enough.

For example, how exactly is

    var element = document.querySelectorAll('.container') 
    element.style.paddingTop = "50px"; 
    element.className = element.className + 'header';
communicating intent better than:

    $('.container').css('padding-top','50').addClass('header')
Re:Removing jQuery from GitHub.com frontend by mercer on Thursday July 26, 2018 @11:24AM (#17618168)
While I do agree in your comparison the second version looks better. At the same time, and this might be a tad too subjective to have much merit, it feels out of place to me.

Instead, I'd use one of the various approaches where I can create a style = {} object and then apply it to the element, which would just fit better within the rest of my javascript.

(which particular approach to use, .cssText, looping through props, or Object.assign, I'm not sure, but my point is any approach that applies a POJO to the node instead of chaining strikes me as more idiomatic. this is not a hill I'd die on though...)

Re:Removing jQuery from GitHub.com frontend by wvenable on Thursday July 26, 2018 @12:07PM (#17618521)
I wonder how many people will notice that your non-jQuery example actually contains a subtle bug.