Josh K
Josh K

Reputation: 28883

Reducing the need for JavaScript libraries

I'm writing several small things in JavaScript, notably a mousemove event, and a AJAX call. I don't believe that two things should necessitate loading the ~25KB that is jQuery. Add in the fact that I want as few external dependencies as possible and necessitating jQuery isn't something I want to do.

Is there a primer / tutorials on rewriting calls between a JavaScript library and pure JavaScript?

Upvotes: 1

Views: 113

Answers (3)

Mark Schultheiss
Mark Schultheiss

Reputation: 34158

You can study the library code, and write your own IF you want to.

Upvotes: 0

FelipeAls
FelipeAls

Reputation: 22161

jQuery uses Sizzle for its selectors magic. I can't remember if it weighs 3 or 7 kB but it's a standalone library

Upvotes: 0

jeanreis
jeanreis

Reputation: 908

For the selector part $("element"), you might as well use Sizzle, which is the same library used in jQuery and other JS framworks, and is only 4kb (minified and gzipped).

As for the $.get() call, a simple wrapper around the native XMLHttpRequest object should suffice, depending on what features exactly do you want to provide. Check the Mozilla Developper Center docs for some pointers.

Upvotes: 5

Related Questions