Article Introduction: The jquery development team released its first beta version of 1.8 today. |
The jquery development team released its first beta version of 1.8 today.
This release introduces a number of new features, including:
1. Modular
In jquery 1.8, you can remove some unwanted modules to build an exclusive jquery version. With a new build system based on grunt, you can easily implement this functionality. Modules that can be removed include Ajax, CSS, dimensions, effects, and offset. See the Readme file for more information.
2. Prefix CSS properties according to browser
Some CSS properties are preceded by a vendor prefix, which indicates that the attribute has not yet been incorporated into the standards of the consortium. In jquery 1.8, you can take a property name with no prefix and automatically generate a prefix suitable for the current browser. For example, in Chrome, jquery calls $ ("#myscroll"). CSS ("marquee-direction", "backwards") will be set to "-webkit-marquee-direction: Backwards ".
3. Animation
In jquery 1.8, you can add or modify animations more easily. The new "$. Animation "provides a solid foundation and fixes many bugs in previous releases so that your animations can support older browsers. If your Web application is only for modern browsers, you can completely remove the animation module.
4. CSS Selector engine sizzle
The selector engine has been overridden in jQuery 1.8, which greatly improves performance. In addition, the selector engine sizzle fixes some edge issues and bugs, including improvements to multiple selectors (~ > +), better detection of browser bugs, and more.
5. XSS Protection
The $ () method can create HTML elements that, if used to pass a <script> tag, can run the script. Developers sometimes forget this by passing untrusted sources or user-entered strings to jquery, which can lead to scripting injections that allow attackers to steal cookies or destroy pages.
JQuery 1.8 introduces a new approach to "$.parsehtml". It allows you to specify HTML strings that will be parsed as HTML, and $ () will be used as selectors to parse strings. "$.parsehtml" also provides a way to parse HTML into a DOM fragment and control the execution of any scripts that might be included. This is particularly important for JavaScript environments controlled by the content security Policy (CSP), because injected scripts can lead to safety warnings or exceptions.
In 1.9, some HTML strings will no longer be recognized by $ ().
6. Features that are not recommended for use or will be removed
- $.browser: Detecting the browser through the user agent string is not a good idea, and will completely remove the method in 1.9, but you can use a compatible plugin. Or you can try Modernizr.
- $.sub: This method was introduced in jquery 1.5, but proved to be not very useful and will be moved to the jquery 1.9 compatibility plug-in.
- Global AJAX Events: Some events, such as Ajaxstart, can be attached to any element that is not in a document, which results in inefficiencies. In 1.9, Ajax events will only be attached to the document.
Further information: JQUERY 1.8 BETA 1
Download Address: Http://code.jquery.com/jquery-1.8b1.js