(Published on the developer site on August 9, 2012)August became a little hotter because jQuery 1.8 was released! You can take the code from the CDN on the jQuery website:
code.jquery.com/jquery-1.8.0.min.js (minified and compressed code for working versions of sites)
code.jquery.com/jquery-1.8.0.js (uncompressed library, for debugging)
As usual, Google and Microsoft CDNs will also distribute these files (do not ask us when - we do not know!). If you really want, use our copy from jQuery CDN.
')
We do not expect you to report bugs in the release version, as there were several beta versions and a release candidate; You had a lot of opportunity for thorough testing (haha, joke). We know that too many of you have been waiting for the final release. So now there is no reason to wait, and you can find out if there are any errors that were reported earlier in the bug reports.
UPD 08/31/2012:
jQuery 1.8.1 .
If you find an error, please create a test for
jsFiddle or
jsbin and send an error report to our bugtracker. If you are not sure that you have found a mistake, we invite you to our forum. The jQuery 1.8.0 kernel is compatible with the latest versions of jQuery UI (1.8.22) and jQuery Mobile (1.1.1). Remember to update them if you report errors on pages that are related to them.
JQuery 1.8 quick review
Here are the important changes in this release:
Sizzle refactoring . The selectors in jQuery have become even faster thanks to the rewriting of the code by Timmy Willison (in fact, two authors). Of course, most browsers have
querySelectorAll , but almost every implementation in some places lags behind in speed and has cross-browser features. Sizzle makes it easy. In addition, you can use selectors of the type
: has () with a complex selector or
: contains () . Oh yeah, IE6 / 7 is still supported.
Redraw the animation . Over time, the animation code in jQuery became rather messy. Corey Frang plunged into this swamp and killed almost all alligators, well, that is, mistakes. Most of the changes are not obvious, the interface is not affected, so the previous animations should work (and work better). But there are some great improvements that make the animation more powerful and expandable. One of the notable and useful features is the use of
progress callbacks in
Promises . We are still working on detailed documentation, but we have a
preliminary draft . And an example of a new code in action:
jsbin.com/odocid/1/edit .
Auto prefix CSS . When using the CSS property -
.css () or
.animate () , we make the correct prefix in the browser styles, if necessary. For example, take
.css ("user-select", "none") . In Chrome / Safari, set the value to "
-webkit-user-select ", in Firefox - "
-moz-user-select ", and IE10 will use "
-ms-user-select ".
More flexible $ (HTML, properties) . In jQuery 1.8, you can use any method or plugin for objects from
$ (html, props) . Previously, a short list of methods was allowed, and there was no documentation of it. Now this list is not needed! But keep in mind that this may lead to a different behavior of your code if the plugin is added later and has the same name as the HTML attributes.
Closed over 160 bugs . In particular, the rewriting of Sizzle and animations gave impetus to correct several old mistakes, some of which are already 2-3 years old. Mike Sherov (Mike Sherov) solved most of the CSS errors and positioning and reduced them to almost zero. In addition, we have not abandoned our line to eliminate the annoying differences between IE 6/7/8 and modern browsers, so you don’t have to deal with them.
Smaller amount of code . Despite all the refactorings, new features and bug fixes, the jQuery 1.8 compressed file has become a few hundred bytes less than in version 1.7.2. Reducing the size was not an end in itself in this version, but we felt that it was important to monitor the growth of the code, and this gave fruit. Many thanks to Richard Gibson, who controls the size of the code for the entire project.
Modularity : If you know your project's jQuery well, you can use the new
grunt-system to cut out a part of jQuery that you definitely won't need. What we did now at 1.8 is really just the beginning; still more flexible in upcoming versions.
A complete list of changes is provided below (in case you are wondering if your favorite bug is fixed).
What was removed
The short answer is “very little.” We would like to provide a complete list of obsolete feature notifications that will be removed in 1.9 to allow time for code adaptation. Some of the things removed in 1.8 are undocumented internal functions that were successfully used by some through reverse engineering, but it is always risky to use undocumented functions. Here is what is removed:
$ (element) .data (“events”) . In version 1.6, jQuery began to separate its internal data from user data to prevent name conflicts. However, some people use undocumented internal “events” of the data structure, so we made it possible to still receive them via .data (). Now this is not possible in 1.8, but you can still get event data for debugging with
$ ._ data (element, "events") . Note that this is not supported by the open interface - the actual data structure may be incompatible from version to version.
Deferred.isResolved () and
Deferred.isRejected () . Calling N-1 methods that return Boolean to get the state of the Nth variable became a bit silly, so we added
Deferred.state () to jQuery 1.7 to determine the state in one call. Thus, these two old methods are no longer needed. This is much more convenient for debugging scripts in which you often want to know the state of Deferred as a string.
$ (element) .closest (Array), which returns an Array . This was a strange feature of the .closest () method needed for the obsolete
.live () , but as far as we know, it was not used by other code. Now, as elsewhere,
.closest () will return a jQuery object.
$ .CurCSS . This method was just a pseudonym for
jQuery.css () , starting with jQuery 1.3. Although the property was never part of the API documentation, some used it. Now he is no more.
$ .AttrFn : Another undocumented property, used to determine which methods can be used in conjunction with
$ (html, props) . Although this does not work in jQuery 1.8, we leave
$ .attrFn empty in jQuery to avoid errors in the code that uses it. Warning: This will be completely removed in jQuery 1.9, so update your code!
Members
This release could not take place without the hard work of a talented team. The main contributors to jQuery are: Julian Aubourg (jaubourg), Corey Frang (gnarf), Richard Gibson (gibson042), Mike Sherov (mikesherov), Rick Waldron (rwaldron), and Timmy Willison (timmywil).
We are grateful to the members of the team and the community who contributed most to the jQuery 1.8 development cycle: Andy Monat, Robert Katic, Joaoh Bruni, Sindre Sorhus Oleg Gaidarenko, Yehuda Katz, Timo Tijhof Dominic D. Geyer Scott Gonzalez, Jorn Zaefferer, Matt Farmer, Trey Hunner, Jason Luna, Ben Alman, Jeffrey For Chris Borchers, Daniel Herman, Vladimir Zhuravlev, Jacob Thornton, Chad Killingsworth, Nowres Rafid, David Benjamin, Uri Gilad, Chris Faulkner, Elijah Manor, and Daniel Chatfield.
We are very grateful to those who took the time to report errors. However, we cannot correct the error if we do not reproduce it. If you're looking for an easy way to contribute to jQuery, look at tracker errors and help us by creating visual regression tests. As soon as we can reproduce the problem, the solution usually follows quickly. These tests will be the basis for unit testing, which will prevent errors in the future for code that does not change in the following editions.
Change Log :
#(The list of bugs and tasks is ambiguous: the headlines do not indicate whether this property was discarded (such as% 80), or the solved problem of obtaining a new property. Compiled by different people at different times, therefore there is no identical terminology in the description. According to the title of the bug, you have to guess everything yourself, but in 98% of cases this is not a problem. The translation can worsen the understanding, so a couple of points are left without translation. However, this is an almost complete list of changes in the library, which will create a presentation. about them. - comment perev.)Ajax
- # 8205 : Random JSONP result causes memory leak in IE8
- # 8653 : jQuery.param displays " null " and " undefined " in the query string
- # 9399 : * jqXHR.success and jqXHR.error are not recommended_
- # 10285 : replacing evalScript -> cleanScript (?) Does not work in IE8
- # 10524 : jQuery.fn.load does not combine data parameter with jQuery.ajaxSetup
- # 10944 : $ .ajax does not always return an object that implements the Promise interface
- # 11013 : * _ Not recommended_ use Deferred / Promise with synchronous $ .ajax
- # 11402 : evalScript function fails with error 80020101 in IE
- # 11743 : jQuery silently ignores errors in the <script> tag during an Ajax request in $ .appendTo ()
- # 11778 : cached XHR requests are always executed asynchronously
- # 12122 : * asynchronous jQuery.ajax () _ is not recommended_ to use with $ .Deferred
Attributes
- # 11153 : jQuery 1.7 behavior when multiple line breaks in IE 8
- # 11212 : Sizzle.getText converts non-breaking spaces into spaces in IE
- # 11547 : XML DOM .removeAttr () does not remove attributes with changed case of letters
- # 11962 : Standardization of returning empty values ​​by getters
- # 12127 : clone () incorrectly copies the checked state in IE10
Build
- # 11767 : Support custom build without effects
- # 11789 : README update to "grunt build" system description
- # 11856 : modularity dimensions
- # 11857 : css modularity
- # 11865 : modularity offset
- # 11965 : ** Creating deprecated.js that lists the maximum outdated constructions
- # 12059 : ` grunt custom` should be minified, + add / remove modules from headers
- # 12158 : jQuery 1.8rc1 does not work with YUICompressor 1.4.7
Core
- # 10657 : * _ Not recommended_ jQuery ... size () , _ recommended jQuery ... length
- # 11290 : selector is interpreted as HTML
- # 11470 : Adding embedded readyP promise
- # 12018 : ** $ (document) .ready () works too early in IE8
- # 12026 : ** Allow $ (html, props) to use any jQuery.fn method
Css
- # 10373 : `document.defaultView` =>` window`
- # 10394 : jQuery.cssHooks.opacity throws an exception in non-IE browsers
- # 10413 : width, innerWidth, innerHeight, outerWidth, outerHeight inaccurate for " box-sizing: border-box " descendants (DOM) of invisible parents
- # 10679 : ** CSS3 vendor prefix support
- # 11004 : getWH incorrectly deletes padding and borders when box-sizing has a border-box
- # 11787 : removing jQuery.curCSS
- # 12088 : Webkit now returns interest on several properties getComputedStyle
- # 12148 : hide event does not work with toggle
"Data"
- # 7579 : jQuery.data () truncates numbers taken from data-xxx attributes
- # 10589 : remove $ .fn.data ("events")
- # 11435 : Obsolete test code to remove toJSON from returned .data values
Deferred
- # 11010 : Make Deferred.then == Deferred.pipe like Promise / A
- # 11011 : Make traditional object options for $ .Callbacks flags
- # 11736 : Delete pending .isResolved () and .isRejected ()
- # 11749 : save object context when multiple pending objects are passed to $ .when ()
Dimensions in DOM
- # 6724 : $ incorrect (window) .height () in Mobile Safari (iPhone)
- # 10877 : Make setter for outerWidth / Height
- # 11293 : Reading empty TD width or outerWidth changes column width
- # 11604 : $ (elem) .width (-val) changes if there is no operation on $ (elem) .width (0)
- # 11724 : $ (document) .height () changed in Firefox 12
Effects
- # 7109 : Animation width starts from the wrong width in the webkit
- # 7157 : The callback function in the animation shows the element still as " : animated "
- # 8387 : with hide / show in webkit for inline and inline-block-elements - problems with flickering
- # 8627 : .animate () does not work with letterSpacing in IE (in versions 1.5.1+)
- # 8892 : callbacks work earlier with fadeIn () and jQuery.fx.off = true
- # 9217 : JS error in IE8: when animating, the element is removed before the animation ends
- # 9505 : animate () - problems when mixing percents and pixels in WebKit
- # 11635 : Explicitly specified overflow: auto property is overridden by overflow: hidden inline code during animation
- # 11755 : animation and its actual analogues should not use selector : hidden
- # 11797 : New animation of related events
- # 11854 : Percentage animation retransmits to its end
- # 11971 : background-position animation doesn’t work IE8
- # 11999 : increment animation for a block with position: fixed performs subtraction instead of adding in Chrome
- # 12117 : overflow: hidden works incorrectly when animating with zero height or width
- # 12138 : fadeOut does not work in Chrome on SVG basic elements
- # 12150 : ** The border-spacing property increases when rows of cells open and hide
Developments
- # 8545 : Leaks during events in IE
- # 10067 : $ .ready appearing with document.readyState === 'interactive' beyond normal
- # 10895 : IE hack IE doScrollCheck in bindReady for no reason slows down speed ie7
- # 11101 : * _Not recommended_ events with the "exclusive" sign from the trigger () method
- # 11315 : Problems with delegate () and : first in nested elements with the same classes
- # 11328 : Ctrl key does not set event.metaKey to true on Windows
- # 11382 : mouseenter is not created on the input tag with disabled
- # 11500 : Bug: the " change " handler is not executed when manually started in IE7 / 8
- # 11621 : Running an event on document does not pop up to window
- # 11718 : * _Not recommended_ event .data ()
- # 11719 : * _Not recommended_ event .bind ("ready") event
- # 11731 : * _Not recommended_ pseudo-event " hover "
- # 11733 : * _The .load () , .unload () , and .error () methods are not recommended
- # 11764 : Allow delegated non-native events on disabled elements
- # 11786 : * _Not recommended_ parameters (signature) .toggle (handler, handler, ...)
- # 12203 : .undelegate () with no arguments unbinds all handlers of the parent element
Manipulations (in DOM)
- # 8894 : appendTo () and similar methods called after clone () return incorrect element set in IE
- # 10324 : clone () does not copy the innerHTML of the object tag in IE9
- # 11231 : Append, Prepend, After, Before should accept an array in the first argument
- # 11325 : Improving domManip / buildFragment / clean
- # 11338 : Incompatible behavior with .replaceWith () and disabled nodes
- # 11528 : serialization error in ie8 with .html () , including html5 tags
- # 11566 : node.append and similar do not work when the node is a DocumentFragment
- # 11617 : define $ .parseHTML method to create HTML fragments
- # 11809 : Memory leaks in the .text (val) (?) Setter
- # 11898 : prevAll () with a complex selector : not () returns results in the wrong order
- # 12132 : IE10 bug when cloning elements that do not have parentNode
offset method ()
- # 10996 : Simplification offset ()
- # 11823 : Remove webkitConvertPointFromNodeToPage
Selectors
- # 3778 : selector search problems
- # 5568 : selectors behave differently with comment tags in FF / IE
- # 7596 : xpath attribute selector with square brackets [] behaves incorrectly
- # 8473 : In IE9rc * [tabIndex] selects all elements, including without tabIndex
- # 8906 :. (PrevAll ('span: has (input, select, textarea)')
- # 9400 : * _Not recommended_ selectors : text,: radio,: checkbox , etc.
- # 9810 : alteration of logic of positional selectors
- # 10003 : Regression / BC break from # 6963
- # 10074 : Coupling 2 square bracket selectors [] with : first does not work
- # 10499 :: nth-child () inside : has () is treated as if it were outside
- # 10570 :: text gives an error in IE7 if the page has a cross-domain iframe
- # 10697 : Sizzle Reconstruction
- # 10799 : Conflicting results of selectors [name = "name"] (also spoils .has )
- # 10809 : Incorrect test using " .activeElement " in : focus
- # 11109 : Sizzle : relative expressions are cut off prematurely
- # 11120 : Bookmarks break (tabs) with some selectors in IE7
- # 11814 : Sizzle element-rooted QSA strategy (for example, attaching temporary id) does not include comma and other delimiters
- # 11826 : Investigate analyzed caching system for matchesSelector with Sizzle
- # 11902 : bug with : not + : contains selectors
- # 11918 : problems with the selector : eq when used with the name of the tag containing ':'
- # 11959 : ** Selector support : active
- # 11961 : "Exceeding maximum stack size" with jQuery ... is ()
- # 11966 : ** descendant selector
- # 11969 : No check for null when searching in neighboring elements (siblings)
- # 12054 : "Uncaught TypeError": Object # <HTMLDocument> does not have a ' getAttribute ' method
- # 12057 : Sizzle Regression
- # 12082 : .find () POS selector does not work from version 1.8b2
- # 12153 : Error occurs in selectors
.support property
- # 9385 : * _Not recommended_ jQuery.browser
- # 11163 : jQuery.support.checkClone is always true
- # 11249 : CSP error in Chrome 18 when loading jQuery 1.7.1
- # 11439 : jQuery.support.parentNode is used, but will no longer be determined
- # 11721 : * _Not recommended_ and removed internal use of jQuery.support.boxModel
- # 11757 : Memory leak in frames in IE8 in jQuery 1.7.2+
- # 11766 : jQuery.support is assigned “unstable” status
Moves
- # 9800 : New .addBack method (instead of .andSelf )
- # 11539 : All jQuery versions do not support .has () in $ (<text_element> .parentNode) .has (another_element)
- # 11543 : .has () does not work on elements that are disconnected from DOM
- # 11706 : .has () does not work on document fragments
- # 11738 : Removed .closest (Array) , returning Array
*) deprecated use of methods and properties;
**) implementation of new features or elimination of significant bugs
(- translation labels) .
Add. QA (from transl. From comments)
Q: how to download not the full library, but select its parts?
A: github.com/jquery/jquery#how-to-build-your-own-jquery
leshaogonkovTo create a custom build, use the following special grunt commands:
Exclude ajax:
grunt custom:-ajax
Exclude css:
grunt custom:-css
Exclude deprecated:
grunt custom:-deprecated
Exclude dimensions:
grunt custom:-dimensions
Exclude effects:
grunt custom:-effects
Exclude offset:
grunt custom:-offset
Exclude all optional modules:
grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-offset
Note: dependencies will be handled internally, by the build process.