Home >Web Front-end >JS Tutorial >jQuery releases new version 3.6.1, check out the improvements!
After more than a year jQuery has released the new version 3.6.1 again. Are you still using JQ? Let's take a look at some improvements of jQuery 3.6.1. I hope it will be helpful to you!
Last week (2022-08-26) jQuery just updated a 3.6.1 maintenance version, and the time since the previous version was released has passed After one year and five months, its maintainers said that they will mainly consider fixing focus and defocus (focus
& blur
) problems and some elusive edge cases. For historical reasons, anything to do with focus in jQuery was hard to change and the team never quite got it right, so they're keeping these for now and will fix them in the future, especially since these changes may eventually A new major version needs to be released. [Related tutorial recommendations: jq tutorial]
The so-called maintenance version refers to a software version that corrects security vulnerabilities or minor errors without changing any core components or adding new features. . They are usually numbered by tenths or hundredths to distinguish them from major releases, and generally software engineers will complete this process as quickly as possible without sacrificing coding quality or reliability.The following are some improvements in jQuery 3.6.1:
Infrastructure improvements
In this version The team has done a lot of work to update some of the project's test and build infrastructure, including migratingCI from Travis CI to GitHub Actions, in Node 16 instead of Node 15, loading their test listeners via https, and adding more custom builds for accurate testing.
Not losing focus
Despite the difficulty, there isone focus-related fix in this release.
Even after removing the jQuery focus handler, our special event handling for focus remains connected, which breaks any subsequent manual focus triggers. For example when:$elem.on("focus", function() {}).off("focus").trigger("focus");
focus will not trigger.
Skip error in addClass(array)
Added without increasing any size Support for skipping any erroneous values in the array passed to addClass or removeClass
. This results in the following code:
elem.addClass( [ "a", "", "b" ] ); // 添加`a`&`b`类。复制代码
Aligns with the specification for custom CSS property valuesNow custom CSS property value
trimmed, something similar before --prop: value ; will retain leading and trailing spaces in the value and return "value
".
Attach a script with HTML comments The team discovered an issue in regular expressions when appending a script from a script Removed HTML comments and finally removed parts of the executable script in some edge cases. Fortunately
relying more on the browsercan be a solution, but the team still needs to get rid of the CDATA part for IE in the 3.x branch. This will be removed in 4.0.
Performance improvements for jQuery.trimAlthough
jQuery.trim has been removed on the master branch in favor of native String#trim
(In preparation for the next major version to go online), but it is still required on the 3.x branch for some browsers supported by the branch (such as Android 4.0). Due to its regular expression structure, some edge cases are very slow. This has now changed, and the speed improvements are significant
.
Project slimmingSometimes you may not need
ajax, or you prefer to choose the request library independently, and will jQuery is used in combination with CSS and class operations, and in Web animation applications. So in addition to the regular Today, the size of jQuery is rarely a load performance issue, with the lite version being about 6k (gzip compressed) smaller than the regular version. These files are also available on npm packages and CDN: These updates are available as current releases on npm and Bower. For information on all of jQuery's methods, visit jquery.com/download/. Continue using JQ You can get the files from the jQuery CDN, or link to them directly: Okay Get this version from npm: Write at the end In an era when single-page applications are becoming popular and various new frameworks are emerging in an endless stream, perhaps few people will pay attention to jQuery anymore, or even avoid it, but its past achievements are still indelible, jQuery is committed to eliminating browser differences and simplifying the methods of operating DOM, allowing early developers to easily implement various operations such as animation and modifying The once glorious JS framework is now gradually fading away. Will we witness its end in the future, or will we watch it improve step by step and then return to the public eye? Finally, I would like to end with a sentence from the few comments below when jQuery 3.6.0 was released: Thank you very much for maintaining and All the hard work that went into improving jQuery because many of us still rely on jQuery for most projects that run in production. 【Recommended learning: jQuery video tutorial, web front-end video】jQuery
version that includes the ajax and effects modules, the team also released a "slim" version that does not include these modules. npm install jquery@3.6.1
CSS
. Say it It is no exaggeration to say that it is the most widely used library in the history of JavaScript.
The above is the detailed content of jQuery releases new version 3.6.1, check out the improvements!. For more information, please follow other related articles on the PHP Chinese website!