Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery What is core.js (in jQuery 3.3.1)

I just downloaded the latest version of jQuery via npm install jquery and it includes three uncompressed files namely:

dist/core.js
dist/jquery.js
dist/jquery.slim.js

I'm wondering what the core.js file is and couldn't find anything documented about it. A google search on core.js and jquery core.js don't return relevant answers.

Also, I don't see any core.min.js. So what is it? Would I ever use it?

NOTE: It uses define() which requires an AMD loader (see https://requirejs.org/docs/whyamd.html#definition ) so it can't just be included straight into an html file.

One jQuery CDN is at https://code.jquery.com, but it doesn't include core.js (from what I saw).

Looking at the code it only defines a small number of functions some of which are:

extend, each, map, slice, first, last, eq, end

It looks like these are also defined in jquery.js and jquery.slim.js.

The jQuery documentation for core at https://api.jquery.com/category/core/ doesn't match what is in the core.js file.

like image 957
PatS Avatar asked Sep 11 '18 15:09

PatS


People also ask

What is jQuery core JS?

jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.

What does the $() mean in jQuery?

In jQuery, the $ sign is just an alias to jQuery() , then an alias for a function. This page reports: Basic syntax is: $(selector).action() A dollar sign to define jQuery. A (selector) to "query (or find)" HTML elements.

What is jQuery min js used for?

In simple terms, it's a minified/compressed version of the JQuery code. Minification is nothing but a process to reduce the size of the file by eliminating spaces, line breaks, comments, variable names, function names, etc. so that the file can be rendered quickly by the performance.


1 Answers

core.js is responsible for defining the jQuery namespace, as well as the prototype for jQuery objects. - How jQuery Works - An Introduction

This below may also be quite useful or at least help you get a better understanding, but to be honest the quote above i would argue is sufficient enough knowledge on the core.js file.

It’s no longer maintained with newer versions, but a few years ago Rob Flaherty created an annotated version of jQuery 1.6’s source.

jQuery v1.6 Annotated Source Docs

Core.js Annotated Source

like image 112
David Avatar answered Oct 12 '22 18:10

David