JQuery: Difference between revisions
Makecat-bot (talk | contribs) m r2.7.3) (Robot: Adding az:JQuery |
→Release history: table fix |
||
Line 297: | Line 297: | ||
| [http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/ January 15, 2013] |
| [http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/ January 15, 2013] |
||
| Removal of deprecated interfaces and code cleanup |
| Removal of deprecated interfaces and code cleanup |
||
| |
|||
|- |
|- |
||
| 1.9.1 |
| 1.9.1 |
Revision as of 06:58, 18 February 2013
Original author(s) | John Resig |
---|---|
Developer(s) | jQuery Team |
Initial release | August 26, 2006 |
Stable release | 1.9.1
/ February 4, 2013[1] |
Preview release | 2.0 beta
/ January 15, 2013[2] |
Repository | |
Written in | JavaScript |
Size | 32 KB zipped / 91.6 KB (production mode) / 252 KB (development mode) |
Type | JavaScript library |
License | MIT[3] |
Website | jquery |
jQuery is a multi-browser JavaScript library designed to simplify the client-side scripting of HTML.[4] It was released in January 2006 at BarCamp NYC by John Resig. It is currently developed by a team of developers led by Dave Methvin. Used by over 55% of the 10,000 most visited websites, jQuery is the most popular JavaScript library in use today.[5][6]
jQuery is free, open source software, licensed under the MIT License.[7] jQuery's syntax is designed to make it easier to navigate a document, select DOM elements, create animations, handle events, and develop Ajax applications. jQuery also provides capabilities for developers to create plug-ins on top of the JavaScript library. This enables developers to create abstractions for low-level interaction and animation, advanced effects and high-level, theme-able widgets. The modular approach to the jQuery library allows the creation of powerful dynamic web pages and web applications.
Microsoft and Nokia have announced plans to bundle jQuery on their platforms.[8] Microsoft is adopting it initially within Visual Studio[9] for use within Microsoft's ASP.NET AJAX framework and ASP.NET MVC Framework while Nokia has integrated it into their Web Run-Time widget development platform.[10] jQuery has also been used in MediaWiki since version 1.16.[11]
Features
jQuery includes the following features:
- DOM element selections using the multi-browsers open source selector engine Sizzle, a spin-off out of the jQuery project[12]
- DOM traversal and modification (including support for CSS 1-3)
- DOM manipulation based on CSS selectors that uses node elements name and node elements attributes (id and class) as criteria to build selectors
- Events
- Effects and animations
- AJAX
- Extensibility through plug-ins
- Utilities - such as user agent information, feature detection
- Compatibility methods that are natively available in modern browsers but need fall backs for older ones - For example the
inArray()
andeach()
functions. - Multi-browser (not to be confused with cross-browser) support.
Including the library
The jQuery library is a single JavaScript file, containing all of its common DOM, event, effects, and Ajax functions. It can be included within a web page by linking to a local copy, or to one of the many copies available from public servers. jQuery has a CDN sponsored by Media Temple[13] (previously at Amazon[14]). Google [15] and Microsoft[16] host it as well.
<script type="text/javascript" src="jquery.js"></script>
The most popular and basic way to introduce a jQuery function is to use the .ready()
function.
$(document).ready(function() {
// script goes here
});
or the shortcut
$(function() {
// script goes here
});
Usage styles
jQuery has two usage styles:
- Via the
$
function, which is a factory method for the jQuery object. These functions, often called commands, are chainable as they all return jQuery objects. - Via
$.
-prefixed functions. These are utility functions, which do not work on the jQuery object per se.
Typically, access to and manipulation of multiple DOM nodes begins with the $
function being called with a CSS selector string, which results in a jQuery object referencing matching elements in the HTML page. This node set can be manipulated by calling instance methods on the jQuery object, or on the nodes themselves. For example:
$("div.test").add("p.quote").addClass("blue").slideDown("slow");
This line finds the union of all div
tags with class attribute test
and all p
tags with CSS class attribute quote
, adds the class attribute blue
to each matched element, and then increases their height with an animation. The $
and add
functions affect the matched set, while the addClass
and slideDown
affect the referenced nodes.
The following script automatically checks whether the jQuery file is included. If not, it appends a jquery reference to the head section
if(!(window.jQuery && window.jQuery.fn.jquery == '1.6.2')) {
var s = document.createElement('script');
s.setAttribute('src', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');
s.setAttribute('type', 'text/javascript');
document.getElementsByTagName('head')[0].appendChild(s);
}
The methods prefixed with $.
are convenience methods or affect global properties and behaviour. For example, the following is an example of the iterating function called each
in jQuery:
$.each([1,2,3], function(){
document.write(this + 1);
});
This writes "234" to the document.
It is possible to perform browser-independent Ajax queries using $.ajax
and associated methods to load and manipulate remote data.
$.ajax({
type: "POST",
url: "example.php",
data: "name=John&location=Boston"
}).done( function(msg){
alert( "Data Saved: " + msg );
}).fail( function( xmlHttpRequest, statusText, errorThrown ) {
alert(
"Your form submission failed.\n\n"
+ "XML Http Request: " + JSON.stringify( xmlHttpRequest )
+ ",\nStatus Text: " + statusText
+ ",\nError Thrown: " + errorThrown );
});
This example posts the data name=John
and location=Boston
to example.php
on the server. When this request finishes successfully, the success function is called to alert the user.
jQuery plug-ins
Because of jQuery's architecture, other developers can use its constructs to create plug-in code to extend its functionality. Currently there are thousands of jQuery plug-ins available on the web[17] that cover a wide range of functionality such as Ajax helpers, webservices, datagrids, dynamic lists, XML and XSLT tools, drag and drop, events, cookie handling, modal windows, even a jQuery-based Commodore 64 emulator.[18]
An important source of jQuery plug-ins is the Plugins sub-domain of the jQuery Project website.[17] However, in an effort to rid the site of spam, the plugins in this subdomain were accidentally deleted in December 2011.[19] The new site will include a GitHub-hosted repository, which will require developers to resubmit their plugins and to conform to new submission requirements.[20] There are alternative plug-in search engines[21][22]like jquer.in that take more specialist approaches, such as listing only plug-ins that meet certain criteria (e.g. those that have a public code repository). The tutorials page on the jQuery site has a list of links to jQuery plug-in tutorials under the "Plugin development" section.[23]
Release history
Version number | Release date | Additional notes |
---|---|---|
1.0 | August 26, 2006 | First stable release |
1.0.1 | August 31, 2006 | |
1.0.2 | October 9, 2006 | |
1.0.3 | October 27, 2006 | |
1.0.4 | December 12, 2006 | Last 1.0 bug fix |
1.1 | January 14, 2007 | |
1.1.1 | January 22, 2007 | |
1.1.2 | February 27, 2007 | |
1.1.3 | July 1, 2007 | |
1.1.3.1 | July 5, 2007 | |
1.1.4 | August 24, 2007 | |
1.2 | September 10, 2007 | |
1.2.1 | September 16, 2007 | |
1.2.2 | January 15, 2008 | |
1.2.3 | February 8, 2008 | |
1.2.4 | May 19, 2008 | |
1.2.5 | May 21, 2008 | Fix for bad build of 1.2.4 |
1.2.6 | May 24, 2008 | |
1.3 | January 14, 2009 | Sizzle Selector Engine introduced into core |
1.3.1 | January 21, 2009 | |
1.3.2 | February 20, 2009 | |
1.4 | January 14, 2010 | |
1.4.1 | January 25, 2010 | |
1.4.2 | February 19, 2010 | |
1.4.3 | October 16, 2010 | |
1.4.4 | November 11, 2010 | |
1.5 | January 31, 2011 | Deferred callback management, ajax module rewrite |
1.5.1 | February 24, 2011 | |
1.5.2 | March 31, 2011 | |
1.6 | May 3, 2011 | Significant performance improvements to the attr() and val() functions |
1.6.1 | May 12, 2011 | |
1.6.2 | June 30, 2011 | |
1.6.3 | September 1, 2011 | |
1.6.4 | September 12, 2011 | |
1.7 | November 3, 2011 | New Event APIs: .on() and .off(), while the old APIs are still supported. |
1.7.1 | November 21, 2011 | |
1.7.2 | March 21, 2012 | |
1.8.0 | August 9, 2012 | Sizzle Selector Engine rewritten, improved animations and $(html, props) flexibility. |
1.8.1 | August 30, 2012 | |
1.8.2 | September 20, 2012 | |
1.8.3 | November 13, 2012 | |
1.9.0 | January 15, 2013 | Removal of deprecated interfaces and code cleanup |
1.9.1 | February 04, 2013 | |
2.0.0 | early 2013 | Dropping IE6-8 support for performance improvements and reduction in filesize |
Testing framework
QUnit is a test automation framework used to test the jQuery project. The jQuery team developed it as an in-house unit testing library.[24] The jQuery team uses it to test its code and plugins but it can test any generic JavaScript code, including server-side JavaScript code.[25]
As of 2011, the jQuery Testing Team uses QUnit with TestSwarm to test each jQuery codebase release.[26]
See also
References
- ^ "jQuery 1.9.1 Released". 2013-02-04.
- ^ "JQUERY 1.9 FINAL, JQUERY 2.0 BETA, MIGRATE FINAL RELEASED". 2013-01-15.
- ^ "License - jQuery Project". jQuery Foundation. Retrieved 05 January 2013.
{{cite web}}
: Check date values in:|accessdate=
(help) - ^ "jQuery: The write less, do more, JavaScript library". The jQuery Project. Retrieved 29 April 2010.
- ^ "jQuery Usage Statistics". Retrieved 2012-04-02.
- ^ "Usage of JavaScript libraries for websites". W3Techs. Retrieved 2010-07-08.
- ^ "License – JQuery JavaScript Library". Retrieved 2009-11-26.
- ^ Resig, John (2008-09-28). "jQuery, Microsoft, and Nokia". jQuery Blog. jQuery. Retrieved 2009-01-29.
- ^ Guthrie, Scott (2008-09-28). "jQuery and Microsoft". ScottGu's Blog. Retrieved 2009-01-29.
- ^ "Guarana UI: A jQuery Based UI Library for Nokia WRT". Forum Nokia. Retrieved 2010-03-30.
- ^ "jQuery". MediaWiki. January 19, 2012. Retrieved March 11, 2012.
- ^ Resig, John (2009-01-14). "jQuery 1.3 and the jQuery Foundation". jQuery Blog. Retrieved 2009-05-04.
- ^ "jQuery CDN - provided by (mt) Media Temple" – http://code.jquery.com/
- ^ "CloudFront CDN for jQuery", November 19th, 2008 by John Resig, blog.jquery.com
- ^ "Google Libraries API - Developer's Guide". code.google.com. Retrieved March 11, 2012.
- ^ "Microsoft Ajax Content Delivery Network". ASP.net. Microsoft Corporation. Retrieved June 19, 2012.
- ^ a b "Plugins". The jQuery Project. Retrieved 26 August 2010.
- ^ "JavaScript Commodore Emulator". Kingsquare. Retrieved 26 August 2010.
- ^ http://blog.jquery.com/2011/12/08/what-is-happening-to-the-jquery-plugins-site/#pluginstldr
- ^ https://github.com/jquery/plugins.jquery.com
- ^ "jQuery Plugins Search". Retrieved 13 September 2012.
- ^ Kanakiya, Jay. "jquery plugins".
- ^ "Tutorials". The jQuery Project. Retrieved 26 August 2010.
- ^ Qunit section of jQuery website, 2011 http://docs.jquery.com/Qunit
- ^ Qunit section of jQuery website, 2012 http://docs.jquery.com/QUnit
- ^ jQuery Testing Team Wiki http://jquerytesting.pbworks.com/w/page/41556026/FrontPage
Further reading
- Taft, Darryl K. (2006-08-30). "jQuery Eases JavaScript, AJAX Development". eWeek. Retrieved 2009-05-04.
- Krill, Paul (2006-08-31). "JavaScript, .Net developers aided in separate project". InfoWorld. Retrieved 2009-05-04.
- John Resig (speaker) (2007-04-13). Advancing JavaScript with Libraries (Part 1) (Yahoo! Video). YUI Theater. Retrieved 2009-05-04.
- John Resig (speaker) (2007-04-13). Advancing JavaScript with Libraries (Part 2) (Yahoo! Video). YUI Theater. Retrieved 2009-05-04.
External links
- Official website
- Quick API Reference
- jQuery UI
- Automatic alerts when new version is has been released
- Dmitri Gaskin (speaker) (2008-04-03). jQuery (YouTube). Google Tech Talks. Retrieved 2009-05-04.