You Don't Need jQuery Build Status

Frontend environments evolve rapidly nowadays, modern browsers have already implemented a great deal of DOM/BOM APIs which are good enough. We don't have to learn jQuery from scratch for DOM manipulation or events. In the meantime, thanks to the prevailing of frontend libraries such as React, Angular and Vue, manipulating DOM directly becomes anti-pattern, jQuery has never been less important. This project summarizes most of the jQuery method alternatives in native implementation, with IE 10+ support.

Table of Contents

  1. Translations
  2. Query Selector
  3. CSS & Style
  4. DOM Manipulation
  5. Ajax
  6. Events
  7. Utilities
  8. Promises
  9. Animation
  10. Alternatives
  11. Browser Support

Translations

Query Selector

In place of common selectors like class, id or attribute we can use document.querySelector or document.querySelectorAll for substitution. The differences lie in:

Notice: document.querySelector and document.querySelectorAll are quite SLOW, try to use document.getElementById, document.getElementsByClassName or document.getElementsByTagName if you want to get a performance bonus.

? back to top

CSS & Style

? back to top

DOM Manipulation

  1. c
  2. d

`);

// Native range = document.createRange(); parse = range.createContextualFragment.bind(range);

parse(`

  1. a
  2. b

  1. c
  2. d

`); ```

? back to top

Ajax

Fetch API is the new standard to replace XMLHttpRequest to do ajax. It works on Chrome and Firefox, you can use polyfills to make it work on legacy browsers.

Try github/fetch on IE9+ or fetch-ie8 on IE8+, fetch-jsonp to make JSONP requests.

? back to top

Events

For a complete replacement with namespace and delegation, refer to https://github.com/oneuijs/oui-dom-events

? back to top

Utilities

Most of utilities are found by native API. Others advanced functions could be chosen better utilities library focus on consistency and performance. Recommend lodash to replace.

? back to top

Promises

A promise represents the eventual result of an asynchronous operation. jQuery has its own way to handle promises. Native JavaScript implements a thin and minimal API to handle promises according to the Promises/A+ specification.

? back to top

Animation

Alternatives

Browser Support

Chrome | Firefox | IE | Opera | Safari --- | --- | --- | --- | --- | Latest ? | Latest ? | 10+ ? | Latest ? | 6.1+ ? |

License

MIT