Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Should I use JQuery?

49 views
Skip to first unread message

wmgill

unread,
Jun 25, 2016, 1:44:07 PM6/25/16
to
I haven't done anything in JavaScript for many years. I avoided it
because of the high percentage of users who had turned it off. It
appears that number is reasonably low, and I see no need to avoid it
anymore as long as I make provisions for the non JS users.

I am updating an old website that I had several simple Flash animations
that I want to replace. I always thought of JQuery as an
over-complicated, unnecessary wrapper for JS, but that thinking may be
wrong. So my question is, if I don't intend to have massive scripting,
but the occasional simple function (e.g. slideshows w/links), should I
install and learn JQuery, or just focus on relearning JS?

Christoph M. Becker

unread,
Jun 25, 2016, 2:17:37 PM6/25/16
to
On 25.06.2016 at 19:43, wmgill wrote:

> I haven't done anything in JavaScript for many years. I avoided it
> because of the high percentage of users who had turned it off. It
> appears that number is reasonably low, and I see no need to avoid it
> anymore as long as I make provisions for the non JS users.

I prefer to think the other way round, i.e. making provisions for
clients which do support scripting.

> I am updating an old website that I had several simple Flash animations
> that I want to replace. I always thought of JQuery as an
> over-complicated, unnecessary wrapper for JS, but that thinking may be
> wrong. So my question is, if I don't intend to have massive scripting,
> but the occasional simple function (e.g. slideshows w/links), should I
> install and learn JQuery, or just focus on relearning JS?

jQuery is a library; as such you will have to "relearn JS" anyway. And
jQuery does not provide much wrt. ECMAScript; it is mostly concerned
with the DOM and some other browser functionality (such as XHR). I
suggest you learn to differentiate between the language (ECMAScript) and
its host environment (e.g. a browser).

See also <http://youmightnotneedjquery.com/>.

--
Christoph M. Becker

Michael Haufe (TNO)

unread,
Jun 25, 2016, 2:39:01 PM6/25/16
to
I will say do it without jQuery and see how far you get. If you run into something that feels awkward or difficult, post here in the the group and we can go from there.

JavaScript and Browsers has evolved significantly since you last played with them I suspect

Michael Haufe (TNO)

unread,
Jun 25, 2016, 4:04:40 PM6/25/16
to
On Saturday, June 25, 2016 at 1:39:01 PM UTC-5, Michael Haufe (TNO) wrote:

> I will say do it without jQuery and see how far you get. If you run into something that feels awkward or difficult, post here in the the group and we can go from there.
>
> JavaScript and Browsers has evolved significantly since you last played with them I suspect

Yuck... drunken replies. Small correction and addition:

JavaScript and browsers HAVE evolved significantly since you last played with them I suspect.

Sadly I still have a number of projects that have jQuery has a dependency, but I've noticed that even with this dependency, only the Ajax related functionality is actually used. For example:

1. $("someSelector") is not necessary since someElement.querySelector("someSelector") and someElement.querySelectorAll("someSelector") exist now in modern browsers:

<https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector>
<https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll>

Often I have two functions available that I use:

var qs = (selector,context) => (context || document).querySelector(selector);
var qsa = (selector,context) => Array.from((context || document).querySelectorAll(selector));

Which lets me do the following:

qs("#someElement").addEventListener(...)

and

qsa(".someElements").map(MyObjectWrapper)

.......

2. Animations: CSS has this now:

<https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Animations>

3. Ajax

Admittedly I still use this functionality from time to time, but if I spent a day playing with it, a comparable or better solution could be created (though I'd personally use Babel or TypeScript to keep this convenient)

4. probably others, but at the moment I think this enough beating of this dead-horse of a library

Evertjan.

unread,
Jun 26, 2016, 6:46:18 AM6/26/16
to
"Michael Haufe (TNO)" wrote on 25 Jun 2016 in
comp.lang.javascript:

> Often I have two functions available that I use:
>
> var qs = (selector,context) => (context ||
> document).querySelector(selector);

> var qsa = (selector,context) =>
> Array.from((context ||
> document).querySelectorAll(selector));

Nice!

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Ram Tobolski

unread,
Jun 27, 2016, 1:00:17 PM6/27/16
to
Yes, nice

Ram Tobolski

unread,
Jun 27, 2016, 1:21:43 PM6/27/16
to
I still find rehab from jQuery difficult, when it comes to DOM queries and manipulation. It is just so elegant. And vanilla js is still not quite there. Even angular.js contains a subset of jQuery (jqlite).

Michael Haufe (TNO)

unread,
Jun 27, 2016, 5:43:01 PM6/27/16
to
On Monday, June 27, 2016 at 12:21:43 PM UTC-5, Ram Tobolski wrote:
> I still find rehab from jQuery difficult, when it comes to DOM queries and manipulation. It is just so elegant. And vanilla js is still not quite there. Even angular.js contains a subset of jQuery (jqlite).

Please quote who and what you are replying to. Not everyone uses Google Groups or an interface that hold onto discussion context.

Evertjan.

unread,
Jun 28, 2016, 6:04:30 AM6/28/16
to
"Michael Haufe (TNO)" <t...@thenewobjective.com> wrote on 27 Jun 2016 in
comp.lang.javascript:
Indeed.

This is Usenet, not a Google group.

wmgill

unread,
Jul 1, 2016, 12:12:33 PM7/1/16
to
On 6/25/2016 2:17 PM, Christoph M. Becker wrote:
>
> I prefer to think the other way round, i.e. making provisions for
> clients which do support scripting.

At the risk of sparking a long chicken/egg philosophical thread, the
only reason I would consider ES is if I want to provide some
functionality or feature that can't be accomplished without it. Then I
would provide a fallback for non ES enabled users. I would never design
a non page, then look for a way to make provisions to use scripting.

> jQuery is a library; as such you will have to "relearn JS" anyway. And
> jQuery does not provide much wrt. ECMAScript; it is mostly concerned
> with the DOM and some other browser functionality (such as XHR). I
> suggest you learn to differentiate between the language (ECMAScript) and
> its host environment (e.g. a browser).

It was not an either/or proposition, I know I have to update my
scripting skills. I just remember JQuery having similar, but
semantically different functions that worked like wrappers but provided
a singular interface to varying DOMs.
Good reference. Thanks.

P.S.
Sorry it took so long to respond. I finally got my newsreader to work on
my Surface Pro. I used to have to use the reader on my (LAN) development
server, which was a major inconvenience. I don't want people to think I
am a hit & run poster.

wmgill

unread,
Jul 1, 2016, 12:34:55 PM7/1/16
to
On 6/25/2016 4:04 PM, Michael Haufe (TNO) wrote:
> On Saturday, June 25, 2016 at 1:39:01 PM UTC-5, Michael Haufe (TNO) wrote:
>
>> I will say do it without jQuery and see how far you get. If you run into something that feels awkward or difficult, post here in the the group and we can go from there.
>>
>> JavaScript and Browsers has evolved significantly since you last played with them I suspect
>
> Yuck... drunken replies. Small correction and addition:
>
> JavaScript and browsers HAVE evolved significantly since you last played with them I suspect.
>

Actually I read you correctly w/o the edit and I wasn't drinking (too
much).<g>

<snip>
Good info and references, thanks.

> 4. probably others, but at the moment I think this enough beating of this dead-horse of a library

I agree, and see where much of the competition for nonstandard
"features" has subsided. I can feel confident with focusing on the
standards, and addressing exceptions on an as needed basis is not only
the way I preferred, but the best approach. I really didn't want to use
2 parallel approaches especially for the minimal amount of code I intend
to employ.


Chris M. Thomasson

unread,
Jul 1, 2016, 4:57:19 PM7/1/16
to
On 7/1/2016 9:12 AM, wmgill wrote:
> On 6/25/2016 2:17 PM, Christoph M. Becker wrote:
[...]
>> See also <http://youmightnotneedjquery.com/>.
>>
> Good reference. Thanks.

I second that. :^)
0 new messages