Compare Β· Core Β· jQuery-compatible
jsKjs vs jQuery
jsKjs implements the jQuery API most code actually uses β on native browser features β and adds three more modules. Here is exactly where it matches, differs and stops.
Choose jsKjs whenβ¦
- You target evergreen browsers and want the jQuery API without the legacy weight.
- You also need declarative requests, reactive state or real animation β without three more libraries.
- You want native Promises,
fetchand WeakMap-based data by default.
Choose jQuery whenβ¦
- You must support Internet Explorer 11 or other pre-2021 browsers.
- You depend on jQuery plugins that use internals (
$.fx,$.Deferred, ajax prefilters/transports). - You rely heavily on the fx queue (
.stop(),.delay(),.queue()).
Feature by feature
Compared with jQuery 4.0.0. β works the same Β· β supported with differences Β· β not included.
| jQuery | jsKjs | Notes |
|---|---|---|
| $() selectors, context, HTML creation, DOM ready | β Yes | Native querySelectorAll; jQuery-only pseudos (:visible, :first) are not CSS. |
| Collection basics: .each .get .eq .first .last .index .add | β Yes | Collections are real Arrays; native .map/.slice return plain arrays. |
| .html .text .val | β Yes | .val() on a checkbox returns a boolean. |
| .attr .removeAttr .prop .data .removeData | β Yes | .data() parses data-* JSON; storage is a WeakMap. |
| .addClass .removeClass .toggleClass .hasClass .css | β Yes | .css() also reads and writes custom properties. |
| .width .height .offset .position .scrollTop .scrollLeft | β Partial | No .innerWidth/.outerWidth or .offset() setter. |
| .show .hide .toggle | β Yes | |
| .append .prepend .before .after .appendTo .prependTo .wrap .remove .detach .empty .clone .replaceWith | β Yes | |
| .wrapAll .wrapInner .unwrap | β No | |
| .find .filter .not .is .closest .parent .parents .children .siblings .next .prev | β Yes | .filter/.not/.is accept selectors, elements or functions. |
| .nextAll .prevAll .nextUntil .prevUntil .parentsUntil .has .contents .end .addBack .slice | β No | |
| .on .off .one .trigger, delegation, namespaces, shortcuts, .hover | β Yes | Handlers receive the native Event; .trigger takes one payload object. |
| .bind .unbind .live .delegate .die | β No | Removed from modern jQuery too β use .on(). |
| $.ajax $.get $.post $.getJSON .load .serialize | β Partial | Promise-based (fetch), not jqXHR; callbacks and .done/.fail/.always still work. |
| $.ajaxSetup, prefilters, transports, JSONP, $.getScript, .serializeArray | β No | |
| .fadeIn .fadeOut .fadeToggle .slideDown .slideUp .slideToggle .animate | β Yes | Same names, milliseconds and callbacks; runs on the Motion engine. |
| .stop .finish .delay .queue .dequeue .fadeTo, $.fx | β No | Use await, timelines or setTimeout. |
| $.Deferred $.Callbacks $.when | β No | Use native Promises. |
| $.each $.map $.extend $.param $.parseHTML $.trim $.isArray $.isFunction $.isPlainObject $.noConflict | β Yes | Deep $.extend is prototype-pollution safe. |
| $.grep $.inArray $.merge $.makeArray $.type $.now | β No | Use Array methods and Date.now(). |
| $.fn plugins | β Partial | $.fn is the collection prototype, so plugins built on supported APIs work. |
| Browser support | β Partial | jsKjs: evergreen only. jQuery 4: also IE11 and older Safari/Firefox. |
Writing a tiny plugin still works
JavaScript
$.fn.highlight = function (color = 'yellow') {
return this.css('background', color); // return this to stay chainable
};
$('.match').highlight();