Global $ Functions

Utilities hang directly off $ (an alias of jQuery 561 ): $.extend([deep], target, ...sources), $.each(), $.map(), $.grep(), $.merge(), $.inArray(), $.uniqueSort(), $.isPlainObject(), $.isEmptyObject(), $.contains(), $.parseHTML(), $.parseXML(), $.escapeSelector(), $.data(el, key, value), $.fn.extend() for plugins and $.noConflict() to release the $ name.

Plugins, deep extend, noConflict and parsing helpersHTMLLive
<script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
<pre id="log" style="margin:0"></pre>
<script>
  const jq = $.noConflict(); // $ is free for another library; jq and jQuery still work
  jq.fn.extend({ highlight(color = 'yellow') { return this.css('background', color); } });
  const log = (msg) => jq('#log').highlight('#e3f2fd').append(document.createTextNode(`${msg}\n`));
  const opts = jq.extend(true, {}, { ui: { theme: 'light', size: 2 } }, { ui: { theme: 'dark' } });
  log(`deep extend: ${JSON.stringify(opts)}`);
  log(`grep: ${jq.grep([5, 12, 8], (n) => n > 6)}, map: ${jq.map([1, [2, 3]], (n) => n)}`);
  const nodes = jq.parseHTML('<b>Hi</b> there<script>alert(1)<\/script>');
  log(`parseHTML: ${nodes.length} nodes (script dropped), escaped: ${jq.escapeSelector('#a.b')}`);
</script>
Browser output of Listing 8.68
Browser output of 68

Native replacements exist for most of them: structuredClone(), Array.prototype methods, Node.contains(), and Function.prototype.bind() for the deprecated $.proxy().