D
D
dron1122020-08-06 11:29:58
WordPress
dron112, 2020-08-06 11:29:58

Why does Wordpress have Jquery built into it by default?

Why this confusion with disabling the default jquery library using the function:
wp_deregister_script( );
And in the future, connecting your version:
Using the functions: wp_register_script() and wp_enqueue_script().

Is this necessary because WP version of Jquery is not up-to-date or what? Why do I disable and then re-enable the same library ???

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex, 2020-08-06
@dron112

Is this necessary because WP version of Jquery is not up-to-date or what? Why do I disable and then re-enable the same library???

You shouldn't do that.
WordPress tries to drag
  1. Good cross-browser compatibility
  2. Good backward compatibility.

Initially, JQ was used specifically for cross-browser compatibility. Support for IE and the like. So that you can go to the admin panel at least on netscape.
Why is it embedded? So that each plugin that depends on JQ does not drag its own version. You understand what it is fraught with.
In modern realities with browser support, it is much easier (and gradually the dependence on Jq is decreasing). The current recommendations for developers look like this:
Last 1 Android versions.
Last 1 ChromeAndroid versions.
Last 2 Chrome versions.
Last 2 Firefox versions.
Last 2 Safari versions.
Last 2 iOS versions.
Last 2 Edge versions.
Last 2 Opera versions.
Internet Explorer >= 11
Browsers with > 1% usage based on can I use browser usage table

But the issue of backwards compatibility remains. A bunch of topics are written for a specific version of JQ. But even if you write your own theme, there are a huge number of plugins that rely on the JQ version built into the core.
I advise you not to use JQ wherever possible when developing a theme. Unless, of course, you don't need the cross-browser compatibility that it offers.
I do not advise you to replace the JQ built into the core with your own, because this way you break backward compatibility with many plugins.

O
Oleg, 2020-08-06
@politon

Because WP is for non-programmers. And jquery, as a panacea for those.
It all depends on the template.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question