Live data from Hacker News

This Week in Rails: jQuery no longer part of Rails, and more

weblog.rubyonrails.org

121–130 of 143 posts

Re: This Week in Rails: jQuery no longer part of Rails, and more

#122
post #90

Earlier quoted context omitted.

I have an example to which maybe you or someone else can suggest a better 'vanilla' solution. Would love to hear suggestions. With jQuery I'd often do $( ).on('click', , callback); crucially, because events bubble up, even a click on a child element of will register as a click on the target element. in plain js it doesn't seem to work that way. I'd do .addEventListener(), but I'd run into the problem that the event.t…

> in plain js it doesn't seem to work that way. I'd do .addEventListener(), but I'd run into the problem that the event.target would point at the exact element that was clicked on instead of the parent element that I wanted to register clicks on. Unless I misunderstand, I think you might be looking for "event.currentTarget". event.target is the element that was clicked on, event.currentTarget is the element that has…

Yeah, but that would then either be 'document' or the 'root' of my widget/component, no? Not the 'item' which is somewhere in between the root and the target. $().on() is very convenient in that way.

Re: This Week in Rails: jQuery no longer part of Rails, and more

#123
post #91

In a way, it's an end of an era. What jQuery did for the industry when it first came out was amazing. Normalizing differing browser APIs, making cumbersome APIs more palatable, providing powerfully expressive query selectors, enabling fairly trivial plugin development, and the nifty monadic chaining. Some of those issues have been addressed by browsers, making vanilla JS a little less unreasonable. For other bits, ra…

Let's be honest, jQuery was a patch for the IE6 bug.

It was much more than that. jQuery made difficult things easy and paved the way for future technologies by using browser specific abilities and providing a unified API for developers to use.

It also standardized around a plugin architecture making it easy for people to write code others could easily reuse.

If you think there is only one iE6 bug that jQuery helped alleviate you'd be wrong. There are thousands of quirks/bugs/proprietary crap that jQuery handled for web developers.

Reducing it to an IE6 bug fix is out of touch with reality.

Re: This Week in Rails: jQuery no longer part of Rails, and more

#124

Earlier quoted context omitted.

Yeah I get flak when I still use jQuery in new projects. Why do I use it? It fucking works, with no need to depend on npm, the application is a lot snappier than using Angular. If I move on from jQuery, it won't be to Angular. I tried React, but I also found it too much boilerplate. I'm trying VueJS next.

I've noticed that the people that ridicule you for using stuff that works (like jQuery) are the same people that have trouble maintaining their own older code, because they'd much rather just start over.

With JQeury, you can reference one file and get going. With Angular, my frustration has been:

* SystemJS - I don't understand what's the problem a lot of the time

* TypeScript tsc deciding that Promise is not a known entity.

* People telling me not to use SystemJS because it's causing me all my problems.

* People telling me not to use Typescript because it's causing all my problems.

* Taking 3 days to switch to something not causing my problems.

* Technology x causing me another set of problems.

Re: This Week in Rails: jQuery no longer part of Rails, and more

#125

I will personally continue to use jQuery for many years to come. It's a lot of power in few concise lines of code and it really makes sense. And it comes at the cost of a single request. For the small amount of JS my sites use its perfect. I don't know why everyone in thread is saying goodbye to jQuery. Are that many people coding in vanilla JS?

Maybe check out Zepto. It aims to have the same API as jQuery without all the debt of supporting older browsers. I still prefer to use jQuery over vanilla JS, but often I'm building apps that'll only be used on evergreen browsers, so that tends to be a better choice for me.

Re: This Week in Rails: jQuery no longer part of Rails, and more

#127
post #91

In a way, it's an end of an era. What jQuery did for the industry when it first came out was amazing. Normalizing differing browser APIs, making cumbersome APIs more palatable, providing powerfully expressive query selectors, enabling fairly trivial plugin development, and the nifty monadic chaining. Some of those issues have been addressed by browsers, making vanilla JS a little less unreasonable. For other bits, ra…

Let's be honest, jQuery was a patch for the IE6 bug.

It was primarily a saner query language for the DOM.

Re: This Week in Rails: jQuery no longer part of Rails, and more

#128
post #91

Earlier quoted context omitted.

Let's be honest, jQuery was a patch for the IE6 bug.

It was much more than that. jQuery made difficult things easy and paved the way for future technologies by using browser specific abilities and providing a unified API for developers to use. It also standardized around a plugin architecture making it easy for people to write code others could easily reuse. If you think there is only one iE6 bug that jQuery helped alleviate you'd be wrong. There are thousands of quirk…

They meant, the bug that was IE6 (all of it).

Re: This Week in Rails: jQuery no longer part of Rails, and more

#129

jQuery was the my first language that got me into coding; I had started javascript but it became very difficult to write a short amount of code for some basic things that I was working with back in 2012. Ruby on Rails was my first framework for developing web applications. I still use it today, but would remove jQuery as a dependency. I thought it was strange how much of dependency it was for certain things like dele…

Javascript is a language; jQuery is only a library written in javascript.

I will concede its API became so ubiquitous that it morphed into some kind of pseudo-DSL.

Re: This Week in Rails: jQuery no longer part of Rails, and more

#130
post #90
post #66

Earlier quoted context omitted.

I use plain JS. Can you give an example of a typical line of jQuery that you prefer over vanilla?

I have an example to which maybe you or someone else can suggest a better 'vanilla' solution. Would love to hear suggestions. With jQuery I'd often do $( ).on('click', , callback); crucially, because events bubble up, even a click on a child element of will register as a click on the target element. in plain js it doesn't seem to work that way. I'd do .addEventListener(), but I'd run into the problem that the event.t…

Not completely sure what you mean. Could you make a minimal example on jsfiddle? Then I can make the vanilla counterpart and we can compare.
Post reply on HN