Commit a9b5f8ac authored by Timmy Willison's avatar Timmy Willison

Release 1.12.2

parent 788eaba2
...@@ -6,10 +6,10 @@ Michael Geary <mike@geary.com> ...@@ -6,10 +6,10 @@ Michael Geary <mike@geary.com>
Stefan Petre <stefan.petre@gmail.com> Stefan Petre <stefan.petre@gmail.com>
Yehuda Katz <wycats@gmail.com> Yehuda Katz <wycats@gmail.com>
Corey Jewett <cj@syntheticplayground.com> Corey Jewett <cj@syntheticplayground.com>
Klaus Hartl <klaus.hartl@gmail.com> Klaus Hartl <klaus.hartl@googlemail.com>
Franck Marcia <franck.marcia@gmail.com> Franck Marcia <franck.marcia@gmail.com>
Jörn Zaefferer <joern.zaefferer@gmail.com> Jörn Zaefferer <joern.zaefferer@gmail.com>
Paul Bakaus <paul.bakaus@gmail.com> Paul Bakaus <paul.bakaus@googlemail.com>
Brandon Aaron <brandon.aaron@gmail.com> Brandon Aaron <brandon.aaron@gmail.com>
Mike Alsup <malsup@gmail.com> Mike Alsup <malsup@gmail.com>
Dave Methvin <dave.methvin@gmail.com> Dave Methvin <dave.methvin@gmail.com>
...@@ -47,7 +47,7 @@ Matt Curry <matt@pseudocoder.com> ...@@ -47,7 +47,7 @@ Matt Curry <matt@pseudocoder.com>
Michael Monteleone <michael@michaelmonteleone.net> Michael Monteleone <michael@michaelmonteleone.net>
Noah Sloan <noah.sloan@gmail.com> Noah Sloan <noah.sloan@gmail.com>
Tom Viner <github@viner.tv> Tom Viner <github@viner.tv>
Douglas Neiner <doug@dougneiner.com> Douglas Neiner <doug@pixelgraphics.us>
Adam J. Sontag <ajpiano@ajpiano.com> Adam J. Sontag <ajpiano@ajpiano.com>
Dave Reed <dareed@microsoft.com> Dave Reed <dareed@microsoft.com>
Ralph Whitbeck <ralph.whitbeck@gmail.com> Ralph Whitbeck <ralph.whitbeck@gmail.com>
...@@ -57,7 +57,7 @@ J. Ryan Stinnett <jryans@gmail.com> ...@@ -57,7 +57,7 @@ J. Ryan Stinnett <jryans@gmail.com>
unknown <Igen005@.upcorp.ad.uprr.com> unknown <Igen005@.upcorp.ad.uprr.com>
temp01 <temp01irc@gmail.com> temp01 <temp01irc@gmail.com>
Heungsub Lee <h@subl.ee> Heungsub Lee <h@subl.ee>
Colin Snover <github.com@zetafleet.com> Colin Snover <colin@alpha.zetafleet.com>
Ryan W Tenney <ryan@10e.us> Ryan W Tenney <ryan@10e.us>
Pinhook <contact@pinhooklabs.com> Pinhook <contact@pinhooklabs.com>
Ron Otten <r.j.g.otten@gmail.com> Ron Otten <r.j.g.otten@gmail.com>
...@@ -69,7 +69,7 @@ Henri Wiechers <hwiechers@gmail.com> ...@@ -69,7 +69,7 @@ Henri Wiechers <hwiechers@gmail.com>
Russell Holbrook <russell.holbrook@patch.com> Russell Holbrook <russell.holbrook@patch.com>
Julian Aubourg <aubourg.julian@gmail.com> Julian Aubourg <aubourg.julian@gmail.com>
Gianni Alessandro Chiappetta <gianni@runlevel6.org> Gianni Alessandro Chiappetta <gianni@runlevel6.org>
Scott Jehl <scottjehl@gmail.com> Scott Jehl <scott@scottjehl.com>
James Burke <jrburke@gmail.com> James Burke <jrburke@gmail.com>
Jonas Pfenniger <jonas@pfenniger.name> Jonas Pfenniger <jonas@pfenniger.name>
Xavi Ramirez <xavi.rmz@gmail.com> Xavi Ramirez <xavi.rmz@gmail.com>
...@@ -78,10 +78,10 @@ Sylvester Keil <sylvester@keil.or.at> ...@@ -78,10 +78,10 @@ Sylvester Keil <sylvester@keil.or.at>
Brandon Sterne <bsterne@mozilla.com> Brandon Sterne <bsterne@mozilla.com>
Mathias Bynens <mathias@qiwi.be> Mathias Bynens <mathias@qiwi.be>
Timmy Willison <timmywillisn@gmail.com> Timmy Willison <timmywillisn@gmail.com>
Corey Frang <gnarf37@gmail.com> Corey Frang <gnarf@gnarf.net>
Digitalxero <digitalxero> Digitalxero <digitalxero>
Anton Kovalyov <anton@kovalyov.net> Anton Kovalyov <anton@kovalyov.net>
David Murdoch <david@davidmurdoch.com> David Murdoch <musicisair@yahoo.com>
Josh Varner <josh.varner@gmail.com> Josh Varner <josh.varner@gmail.com>
Charles McNulty <cmcnulty@kznf.com> Charles McNulty <cmcnulty@kznf.com>
Jordan Boesch <jboesch26@gmail.com> Jordan Boesch <jboesch26@gmail.com>
...@@ -139,7 +139,7 @@ Chris Faulkner <thefaulkner@gmail.com> ...@@ -139,7 +139,7 @@ Chris Faulkner <thefaulkner@gmail.com>
Elijah Manor <elijah.manor@gmail.com> Elijah Manor <elijah.manor@gmail.com>
Daniel Chatfield <chatfielddaniel@gmail.com> Daniel Chatfield <chatfielddaniel@gmail.com>
Nikita Govorov <nikita.govorov@gmail.com> Nikita Govorov <nikita.govorov@gmail.com>
Wesley Walser <waw325@gmail.com> Wesley Walser <wwalser@atlassian.com>
Mike Pennisi <mike@mikepennisi.com> Mike Pennisi <mike@mikepennisi.com>
Markus Staab <markus.staab@redaxo.de> Markus Staab <markus.staab@redaxo.de>
Dave Riddle <david@joyvuu.com> Dave Riddle <david@joyvuu.com>
...@@ -170,8 +170,6 @@ Paul Ramos <paul.b.ramos@gmail.com> ...@@ -170,8 +170,6 @@ Paul Ramos <paul.b.ramos@gmail.com>
Rod Vagg <rod@vagg.org> Rod Vagg <rod@vagg.org>
Bennett Sorbo <bsorbo@gmail.com> Bennett Sorbo <bsorbo@gmail.com>
Sebastian Burkhard <sebi.burkhard@gmail.com> Sebastian Burkhard <sebi.burkhard@gmail.com>
Zachary Adam Kaplan <razic@viralkitty.com>
nanto_vi <nanto@moon.email.ne.jp>
nanto <nanto@moon.email.ne.jp> nanto <nanto@moon.email.ne.jp>
Danil Somsikov <danilasomsikov@gmail.com> Danil Somsikov <danilasomsikov@gmail.com>
Ryunosuke SATO <tricknotes.rs@gmail.com> Ryunosuke SATO <tricknotes.rs@gmail.com>
...@@ -179,70 +177,62 @@ Jean Boussier <jean.boussier@gmail.com> ...@@ -179,70 +177,62 @@ Jean Boussier <jean.boussier@gmail.com>
Adam Coulombe <me@adam.co> Adam Coulombe <me@adam.co>
Andrew Plummer <plummer.andrew@gmail.com> Andrew Plummer <plummer.andrew@gmail.com>
Mark Raddatz <mraddatz@gmail.com> Mark Raddatz <mraddatz@gmail.com>
Isaac Z. Schlueter <i@izs.me>
Karl Sieburg <ksieburg@yahoo.com>
Pascal Borreli <pascal@borreli.com>
Nguyen Phuc Lam <ruado1987@gmail.com>
Dmitry Gusev <dmitry.gusev@gmail.com> Dmitry Gusev <dmitry.gusev@gmail.com>
Michał Gołębiowski <m.goleb@gmail.com> Michał Gołębiowski <m.goleb@gmail.com>
Li Xudong <istonelee@gmail.com> Nguyen Phuc Lam <ruado1987@gmail.com>
Steven Benner <admin@stevenbenner.com>
Tom H Fuertes <tomfuertes@gmail.com> Tom H Fuertes <tomfuertes@gmail.com>
Renato Oliveira dos Santos <ros3@cin.ufpe.br> Brandon Johnson <bjohn465+github@gmail.com>
ros3cin <ros3@cin.ufpe.br>
Jason Bedard <jason+jquery@jbedard.ca> Jason Bedard <jason+jquery@jbedard.ca>
Kyle Robinson Young <kyle@dontkry.com> Kyle Robinson Young <kyle@dontkry.com>
Renato Oliveira dos Santos <ros3@cin.ufpe.br>
Chris Talkington <chris@talkingtontech.com> Chris Talkington <chris@talkingtontech.com>
Eddie Monge <eddie@eddiemonge.com> Eddie Monge <eddie@eddiemonge.com>
Terry Jones <terry@jon.es> Terry Jones <terry@jon.es>
Jason Merino <jasonmerino@gmail.com> Jason Merino <jasonmerino@gmail.com>
Jeremy Dunck <jdunck@gmail.com> Jeremy Dunck <jdunck@gmail.com>
Chris Price <price.c@gmail.com> Chris Price <price.c@gmail.com>
Guy Bedford <guybedford@gmail.com>
Amey Sakhadeo <me@ameyms.com> Amey Sakhadeo <me@ameyms.com>
Mike Sidorov <mikes.ekb@gmail.com>
Anthony Ryan <anthonyryan1@gmail.com> Anthony Ryan <anthonyryan1@gmail.com>
Dominik D. Geyer <dominik.geyer@gmail.com> Dominik D. Geyer <dominik.geyer@gmail.com>
George Kats <katsgeorgeek@gmail.com> George Kats <katsgeorgeek@gmail.com>
Lihan Li <frankieteardrop@gmail.com> Lihan Li <frankieteardrop@gmail.com>
Ronny Springer <springer.ronny@gmail.com> Ronny Springer <springer.ronny@gmail.com>
Chris Antaki <ChrisAntaki@gmail.com>
Marian Sollmann <marian.sollmann@cargomedia.ch> Marian Sollmann <marian.sollmann@cargomedia.ch>
njhamann <njhamann@gmail.com> Corey Frang <gnarf37@gmail.com>
Ilya Kantor <iliakan@gmail.com> Chris Antaki <ChrisAntaki@gmail.com>
Noah Hamann <njhamann@gmail.com>
David Hong <d.hong@me.com> David Hong <d.hong@me.com>
John Paul <john@johnkpaul.com>
Jakob Stoeck <jakob@pokermania.de> Jakob Stoeck <jakob@pokermania.de>
Christopher Jones <chris@cjqed.com> Christopher Jones <christopherjonesqed@gmail.com>
Forbes Lindesay <forbes@lindesay.co.uk> Forbes Lindesay <forbes@lindesay.co.uk>
John Paul <john@johnkpaul.com>
S. Andrew Sheppard <andrew@wq.io> S. Andrew Sheppard <andrew@wq.io>
Leonardo Balter <leonardo.balter@gmail.com> Leonardo Balter <leonardo.balter@gmail.com>
Roman Reiß <me@silverwind.io> Roman Reiß <me@silverwind.io>
Benjy Cui <benjytrys@gmail.com> Benjy Cui <benjytrys@gmail.com>
Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com> Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
John Hoven <hovenj@gmail.com> John Hoven <hovenj@gmail.com>
Philip Jägenstedt <philip@foolip.org>
Christian Kosmowski <ksmwsk@gmail.com> Christian Kosmowski <ksmwsk@gmail.com>
Liang Peng <poppinlp@gmail.com> Liang Peng <poppinlp@gmail.com>
TJ VanToll <tj.vantoll@gmail.com> TJ VanToll <tj.vantoll@gmail.com>
Senya Pugach <upisfree@outlook.com> Senya Pugach <upisfree@outlook.com>
Aurelio De Rosa <aurelioderosa@gmail.com> Aurelio De Rosa <aurelioderosa@gmail.com>
Nazar Mokrynskyi <nazar@mokrynskyi.com> Nazar Mokrynskyi <nazar@mokrynskyi.com>
Amit Merchant <bullredeyes@gmail.com>
Jason Bedard <jason+github@jbedard.ca>
Arthur Verschaeve <contact@arthurverschaeve.be> Arthur Verschaeve <contact@arthurverschaeve.be>
Dan Hart <danhart@notonthehighstreet.com> Dan Hart <danhart@notonthehighstreet.com>
Scott González <scott.gonzalez@gmail.com>
Zheming Sun <mescodasun@gmail.com>
Bin Xin <rhyzix@gmail.com> Bin Xin <rhyzix@gmail.com>
David Corbacho <davidcorbacho@gmail.com> David Corbacho <davidcorbacho@gmail.com>
Veaceslav Grimalschi <grimalschi@yandex.ru> Veaceslav Grimalschi <grimalschi@yandex.ru>
Daniel Husar <dano.husar@gmail.com> Daniel Husar <dano.husar@gmail.com>
Frederic Hemberger <mail@frederic-hemberger.de> Jason Bedard <jason+github@jbedard.ca>
Ben Toews <mastahyeti@gmail.com> Ben Toews <mastahyeti@gmail.com>
Aditya Raghavan <araghavan3@gmail.com> Aditya Raghavan <araghavan3@gmail.com>
Victor Homyakov <vkhomyackov@gmail.com>
Shivaji Varma <contact@shivajivarma.com>
Nicolas HENRY <icewil@gmail.com> Nicolas HENRY <icewil@gmail.com>
Norman Xu <homyu.shinn@gmail.com>
Anne-Gaelle Colom <coloma@westminster.ac.uk> Anne-Gaelle Colom <coloma@westminster.ac.uk>
Victor Homyakov <vkhomyackov@gmail.com>
George Mauer <gmauer@gmail.com> George Mauer <gmauer@gmail.com>
Leonardo Braga <leonardo.braga@gmail.com> Leonardo Braga <leonardo.braga@gmail.com>
Stephen Edgar <stephen@netweb.com.au> Stephen Edgar <stephen@netweb.com.au>
...@@ -256,22 +246,20 @@ Calvin Metcalf <calvin.metcalf@gmail.com> ...@@ -256,22 +246,20 @@ Calvin Metcalf <calvin.metcalf@gmail.com>
Mu Haibao <mhbseal@163.com> Mu Haibao <mhbseal@163.com>
Richard McDaniel <rm0026@uah.edu> Richard McDaniel <rm0026@uah.edu>
Chris Rebert <github@rebertia.com> Chris Rebert <github@rebertia.com>
Gabriel Schulhof <gabriel.schulhof@intel.com>
Gilad Peleg <giladp007@gmail.com> Gilad Peleg <giladp007@gmail.com>
Martin Naumann <martin@geekonaut.de> Martin Naumann <martin@geekonaut.de>
Marek Lewandowski <m.lewandowski@cksource.com>
Bruno Pérel <brunoperel@gmail.com> Bruno Pérel <brunoperel@gmail.com>
Reed Loden <reed@reedloden.com> Reed Loden <reed@reedloden.com>
Daniel Nill <daniellnill@gmail.com> Daniel Nill <daniellnill@gmail.com>
Yongwoo Jeon <yongwoo.jeon@navercorp.com> Yongwoo Jeon <yongwoo.jeon@navercorp.com>
Sean Henderson <seanh.za@gmail.com> Sean Henderson <seanh.za@gmail.com>
Adrian Olek <adrianolek@gmail.com>
Richard Kraaijenhagen <stdin+git@riichard.com> Richard Kraaijenhagen <stdin+git@riichard.com>
Connor Atherton <c.liam.atherton@gmail.com>
Gary Ye <garysye@gmail.com> Gary Ye <garysye@gmail.com>
Christian Grete <webmaster@christiangrete.com> Christian Grete <webmaster@christiangrete.com>
Liza Ramo <liza.h.ramo@gmail.com> Liza Ramo <liza.h.ramo@gmail.com>
Julian Alexander Murillo <julian.alexander.murillo@gmail.com>
Joelle Fleurantin <joasqueeniebee@gmail.com> Joelle Fleurantin <joasqueeniebee@gmail.com>
Julian Alexander Murillo <julian.alexander.murillo@gmail.com>
Jun Sun <klsforever@gmail.com> Jun Sun <klsforever@gmail.com>
Devin Wilson <dwilson6.github@gmail.com> Devin Wilson <dwilson6.github@gmail.com>
Todor Prikumov <tono_pr@abv.bg> Todor Prikumov <tono_pr@abv.bg>
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
"name": "jquery", "name": "jquery",
"title": "jQuery", "title": "jQuery",
"description": "JavaScript library for DOM operations", "description": "JavaScript library for DOM operations",
"version": "2.2.1", "version": "1.12.2",
"main": "dist/jquery.js", "main": "dist/jquery.js",
"homepage": "http://jquery.com", "homepage": "http://jquery.com",
"author": { "author": {
"name": "jQuery Foundation and other contributors", "name": "jQuery Foundation and other contributors",
"url": "https://github.com/jquery/jquery/blob/2.2.1/AUTHORS.txt" "url": "https://github.com/jquery/jquery/blob/1.12-stable/AUTHORS.txt"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
...@@ -41,10 +41,11 @@ ...@@ -41,10 +41,11 @@
"gzip-js": "0.3.2", "gzip-js": "0.3.2",
"jsdom": "5.6.1", "jsdom": "5.6.1",
"load-grunt-tasks": "1.0.0", "load-grunt-tasks": "1.0.0",
"npm": "2.1.12",
"qunitjs": "1.17.1", "qunitjs": "1.17.1",
"qunit-assert-step": "1.0.3", "qunit-assert-step": "1.0.3",
"requirejs": "2.1.17", "requirejs": "2.1.17",
"sinon": "1.10.3", "sinon": "1.12.2",
"sizzle": "2.2.1", "sizzle": "2.2.1",
"strip-json-comments": "1.0.3", "strip-json-comments": "1.0.3",
"testswarm": "1.1.0", "testswarm": "1.1.0",
......
Copyright jQuery Foundation and other contributors, https://jquery.org/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/sizzle
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
All files located in the node_modules and external directories are
externally maintained libraries used by this software which have their
own licenses; we recommend you read them, as their terms may differ from
the terms above.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"undef": true, "undef": true,
"unused": true, "unused": true,
"evil": true,
"sub": true, "sub": true,
// Support: IE < 10, Android < 4.1 // Support: IE < 10, Android < 4.1
...@@ -22,8 +23,8 @@ ...@@ -22,8 +23,8 @@
"JSON": false, "JSON": false,
"jQuery": true, "jQuery": true,
"define": true, "define": false,
"module": true, "module": false,
"noGlobal": true "noGlobal": true
} }
} }
...@@ -9,19 +9,21 @@ define( [ ...@@ -9,19 +9,21 @@ define( [
"./core/init", "./core/init",
"./ajax/parseJSON", "./ajax/parseJSON",
"./ajax/parseXML", "./ajax/parseXML",
"./event/trigger",
"./deferred" "./deferred"
], function( jQuery, document, rnotwhite, location, nonce, rquery ) { ], function( jQuery, document, rnotwhite, location, nonce, rquery ) {
var var
rhash = /#.*$/, rhash = /#.*$/,
rts = /([?&])_=[^&]*/, rts = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
// IE leaves an \r character at EOL
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
// #7653, #8125, #8152: local protocol detection // #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/, rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//, rprotocol = /^\/\//,
rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
/* Prefilters /* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
...@@ -44,9 +46,11 @@ var ...@@ -44,9 +46,11 @@ var
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat( "*" ), allTypes = "*/".concat( "*" ),
// Anchor tag for parsing the document origin // Document location
originAnchor = document.createElement( "a" ); ajaxLocation = location.href,
originAnchor.href = location.href;
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) { function addToPrefiltersOrTransports( structure ) {
...@@ -69,7 +73,7 @@ function addToPrefiltersOrTransports( structure ) { ...@@ -69,7 +73,7 @@ function addToPrefiltersOrTransports( structure ) {
while ( ( dataType = dataTypes[ i++ ] ) ) { while ( ( dataType = dataTypes[ i++ ] ) ) {
// Prepend if requested // Prepend if requested
if ( dataType[ 0 ] === "+" ) { if ( dataType.charAt( 0 ) === "+" ) {
dataType = dataType.slice( 1 ) || "*"; dataType = dataType.slice( 1 ) || "*";
( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
...@@ -113,7 +117,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX ...@@ -113,7 +117,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
// that takes "flat" options (not to be deep extended) // that takes "flat" options (not to be deep extended)
// Fixes #9887 // Fixes #9887
function ajaxExtend( target, src ) { function ajaxExtend( target, src ) {
var key, deep, var deep, key,
flatOptions = jQuery.ajaxSettings.flatOptions || {}; flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) { for ( key in src ) {
...@@ -133,8 +137,7 @@ function ajaxExtend( target, src ) { ...@@ -133,8 +137,7 @@ function ajaxExtend( target, src ) {
* - returns the corresponding response * - returns the corresponding response
*/ */
function ajaxHandleResponses( s, jqXHR, responses ) { function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
var ct, type, finalDataType, firstDataType,
contents = s.contents, contents = s.contents,
dataTypes = s.dataTypes; dataTypes = s.dataTypes;
...@@ -223,7 +226,7 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) { ...@@ -223,7 +226,7 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
if ( current ) { if ( current ) {
// There's only work to do if current dataType is non-auto // There's only work to do if current dataType is non-auto
if ( current === "*" ) { if ( current === "*" ) {
current = prev; current = prev;
...@@ -266,7 +269,7 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) { ...@@ -266,7 +269,7 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
if ( conv !== true ) { if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them // Unless errors are allowed to bubble, catch and return them
if ( conv && s.throws ) { if ( conv && s[ "throws" ] ) { // jscs:ignore requireDotNotation
response = conv( response ); response = conv( response );
} else { } else {
try { try {
...@@ -296,9 +299,9 @@ jQuery.extend( { ...@@ -296,9 +299,9 @@ jQuery.extend( {
etag: {}, etag: {},
ajaxSettings: { ajaxSettings: {
url: location.href, url: ajaxLocation,
type: "GET", type: "GET",
isLocal: rlocalProtocol.test( location.protocol ), isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true, global: true,
processData: true, processData: true,
async: true, async: true,
...@@ -390,26 +393,30 @@ jQuery.extend( { ...@@ -390,26 +393,30 @@ jQuery.extend( {
// Force options to be an object // Force options to be an object
options = options || {}; options = options || {};
var transport, var
// Cross-domain detection vars
parts,
// Loop variable
i,
// URL without anti-cache param // URL without anti-cache param
cacheURL, cacheURL,
// Response headers // Response headers as string
responseHeadersString, responseHeadersString,
responseHeaders,
// timeout handle // timeout handle
timeoutTimer, timeoutTimer,
// Url cleanup var
urlAnchor,
// To know if global events are to be dispatched // To know if global events are to be dispatched
fireGlobals, fireGlobals,
// Loop variable transport,
i,
// Response headers
responseHeaders,
// Create the final options object // Create the final options object
s = jQuery.ajaxSetup( {}, options ), s = jQuery.ajaxSetup( {}, options ),
...@@ -518,11 +525,12 @@ jQuery.extend( { ...@@ -518,11 +525,12 @@ jQuery.extend( {
jqXHR.error = jqXHR.fail; jqXHR.error = jqXHR.fail;
// Remove hash character (#7531: and string promotion) // Remove hash character (#7531: and string promotion)
// Add protocol if not provided (prefilters might expect it) // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature) // Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available // We also use the url parameter if available
s.url = ( ( url || s.url || location.href ) + "" ).replace( rhash, "" ) s.url = ( ( url || s.url || ajaxLocation ) + "" )
.replace( rprotocol, location.protocol + "//" ); .replace( rhash, "" )
.replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Alias method option to type as per ticket #12004 // Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type; s.type = options.method || options.type || s.method || s.type;
...@@ -530,26 +538,14 @@ jQuery.extend( { ...@@ -530,26 +538,14 @@ jQuery.extend( {
// Extract dataTypes list // Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
// A cross-domain request is in order when the origin doesn't match the current origin. // A cross-domain request is in order when we have a protocol:host:port mismatch
if ( s.crossDomain == null ) { if ( s.crossDomain == null ) {
urlAnchor = document.createElement( "a" ); parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
// Support: IE8-11+ ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
// IE throws exception if url is malformed, e.g. http://example.com:80x/ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
try { ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
urlAnchor.href = s.url; );
// Support: IE8-11+
// Anchor's host property isn't correctly set when s.url is relative
urlAnchor.href = urlAnchor.href;
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
urlAnchor.protocol + "//" + urlAnchor.host;
} catch ( e ) {
// If there is an error parsing the URL, assume it is crossDomain,
// it can be rejected by the transport if it is invalid
s.crossDomain = true;
}
} }
// Convert data if not already a string // Convert data if not already a string
...@@ -644,7 +640,7 @@ jQuery.extend( { ...@@ -644,7 +640,7 @@ jQuery.extend( {
return jqXHR.abort(); return jqXHR.abort();
} }
// Aborting is no longer a cancellation // aborting is no longer a cancellation
strAbort = "abort"; strAbort = "abort";
// Install callbacks on deferreds // Install callbacks on deferreds
...@@ -765,7 +761,8 @@ jQuery.extend( { ...@@ -765,7 +761,8 @@ jQuery.extend( {
} }
} else { } else {
// Extract error from statusText and normalize for non-aborts // We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText; error = statusText;
if ( status || !statusText ) { if ( status || !statusText ) {
statusText = "error"; statusText = "error";
...@@ -823,7 +820,7 @@ jQuery.extend( { ...@@ -823,7 +820,7 @@ jQuery.extend( {
jQuery.each( [ "get", "post" ], function( i, method ) { jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) { jQuery[ method ] = function( url, data, callback, type ) {
// Shift arguments if data argument was omitted // shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) { if ( jQuery.isFunction( data ) ) {
type = type || callback; type = type || callback;
callback = data; callback = data;
......
...@@ -53,7 +53,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { ...@@ -53,7 +53,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
return responseContainer[ 0 ]; return responseContainer[ 0 ];
}; };
// Force json dataType // force json dataType
s.dataTypes[ 0 ] = "json"; s.dataTypes[ 0 ] = "json";
// Install callback // Install callback
...@@ -77,10 +77,10 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { ...@@ -77,10 +77,10 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
// Save back as free // Save back as free
if ( s[ callbackName ] ) { if ( s[ callbackName ] ) {
// Make sure that re-using the options doesn't screw things around // make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback; s.jsonpCallback = originalSettings.jsonpCallback;
// Save the callback name for future use // save the callback name for future use
oldCallbacks.push( callbackName ); oldCallbacks.push( callbackName );
} }
......
...@@ -26,7 +26,7 @@ jQuery.fn.load = function( url, params, callback ) { ...@@ -26,7 +26,7 @@ jQuery.fn.load = function( url, params, callback ) {
off = url.indexOf( " " ); off = url.indexOf( " " );
if ( off > -1 ) { if ( off > -1 ) {
selector = jQuery.trim( url.slice( off ) ); selector = jQuery.trim( url.slice( off, url.length ) );
url = url.slice( 0, off ); url = url.slice( 0, off );
} }
......
...@@ -2,10 +2,50 @@ define( [ ...@@ -2,10 +2,50 @@ define( [
"../core" "../core"
], function( jQuery ) { ], function( jQuery ) {
// Support: Android 2.3 var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
// Workaround failure to string-cast null input
jQuery.parseJSON = function( data ) { jQuery.parseJSON = function( data ) {
return JSON.parse( data + "" );
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
// Support: Android 2.3
// Workaround failure to string-cast null input
return window.JSON.parse( data + "" );
}
var requireNonComma,
depth = null,
str = jQuery.trim( data + "" );
// Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
// after removing valid tokens
return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
// Force termination if we see a misplaced comma
if ( requireNonComma && comma ) {
depth = 0;
}
// Perform no more replacements after returning to outermost depth
if ( depth === 0 ) {
return token;
}
// Commas must not follow "[", "{", or ","
requireNonComma = open || comma;
// Determine new depth
// array/object open ("[" or "{"): depth += true - false (increment)
// array/object close ("]" or "}"): depth += false - true (decrement)
// other cases ("," or primitive): depth += true - true (numeric cast)
depth += !close - !open;
// Remove this token
return "";
} ) ) ?
( Function( "return " + str ) )() :
jQuery.error( "Invalid JSON: " + data );
}; };
return jQuery.parseJSON; return jQuery.parseJSON;
......
...@@ -4,19 +4,23 @@ define( [ ...@@ -4,19 +4,23 @@ define( [
// Cross-browser xml parsing // Cross-browser xml parsing
jQuery.parseXML = function( data ) { jQuery.parseXML = function( data ) {
var xml; var xml, tmp;
if ( !data || typeof data !== "string" ) { if ( !data || typeof data !== "string" ) {
return null; return null;
} }
// Support: IE9
try { try {
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); if ( window.DOMParser ) { // Standard
tmp = new window.DOMParser();
xml = tmp.parseFromString( data, "text/xml" );
} else { // IE
xml = new window.ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch ( e ) { } catch ( e ) {
xml = undefined; xml = undefined;
} }
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data ); jQuery.error( "Invalid XML: " + data );
} }
return xml; return xml;
......
...@@ -4,6 +4,13 @@ define( [ ...@@ -4,6 +4,13 @@ define( [
"../ajax" "../ajax"
], function( jQuery, document ) { ], function( jQuery, document ) {
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
jQuery.ajaxPrefilter( function( s ) {
if ( s.crossDomain ) {
s.contents.script = false;
}
} );
// Install script dataType // Install script dataType
jQuery.ajaxSetup( { jQuery.ajaxSetup( {
accepts: { accepts: {
...@@ -21,13 +28,14 @@ jQuery.ajaxSetup( { ...@@ -21,13 +28,14 @@ jQuery.ajaxSetup( {
} }
} ); } );
// Handle cache's special case and crossDomain // Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) { jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) { if ( s.cache === undefined ) {
s.cache = false; s.cache = false;
} }
if ( s.crossDomain ) { if ( s.crossDomain ) {
s.type = "GET"; s.type = "GET";
s.global = false;
} }
} ); } );
...@@ -36,29 +44,55 @@ jQuery.ajaxTransport( "script", function( s ) { ...@@ -36,29 +44,55 @@ jQuery.ajaxTransport( "script", function( s ) {
// This transport only deals with cross domain requests // This transport only deals with cross domain requests
if ( s.crossDomain ) { if ( s.crossDomain ) {
var script, callback;
var script,
head = document.head || jQuery( "head" )[ 0 ] || document.documentElement;
return { return {
send: function( _, complete ) {
script = jQuery( "<script>" ).prop( { send: function( _, callback ) {
charset: s.scriptCharset,
src: s.url script = document.createElement( "script" );
} ).on(
"load error", script.async = true;
callback = function( evt ) {
script.remove(); if ( s.scriptCharset ) {
callback = null; script.charset = s.scriptCharset;
if ( evt ) { }
complete( evt.type === "error" ? 404 : 200, evt.type );
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( script.parentNode ) {
script.parentNode.removeChild( script );
}
// Dereference the script
script = null;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
} }
} }
); };
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
// Use native DOM manipulation to avoid our domManip AJAX trickery // Use native DOM manipulation to avoid our domManip AJAX trickery
document.head.appendChild( script[ 0 ] ); head.insertBefore( script, head.firstChild );
}, },
abort: function() { abort: function() {
if ( callback ) { if ( script ) {
callback(); script.onload( undefined, true );
} }
} }
}; };
......
This diff is collapsed.
define( [ define( [
"./core", "./core",
"./attributes/val",
"./attributes/attr", "./attributes/attr",
"./attributes/prop", "./attributes/prop",
"./attributes/classes", "./attributes/classes"
"./attributes/val"
], function( jQuery ) { ], function( jQuery ) {
// Return jQuery for attributes-only inclusion // Return jQuery for attributes-only inclusion
......
...@@ -3,11 +3,15 @@ define( [ ...@@ -3,11 +3,15 @@ define( [
"../core/access", "../core/access",
"./support", "./support",
"../var/rnotwhite", "../var/rnotwhite",
"./val",
"../selector" "../selector"
], function( jQuery, access, support, rnotwhite ) { ], function( jQuery, access, support, rnotwhite ) {
var boolHook, var nodeHook, boolHook,
attrHandle = jQuery.expr.attrHandle; attrHandle = jQuery.expr.attrHandle,
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = support.getSetAttribute,
getSetInput = support.input;
jQuery.fn.extend( { jQuery.fn.extend( {
attr: function( name, value ) { attr: function( name, value ) {
...@@ -41,7 +45,7 @@ jQuery.extend( { ...@@ -41,7 +45,7 @@ jQuery.extend( {
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
name = name.toLowerCase(); name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || hooks = jQuery.attrHooks[ name ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
} }
if ( value !== undefined ) { if ( value !== undefined ) {
...@@ -74,6 +78,9 @@ jQuery.extend( { ...@@ -74,6 +78,9 @@ jQuery.extend( {
set: function( elem, value ) { set: function( elem, value ) {
if ( !support.radioValue && value === "radio" && if ( !support.radioValue && value === "radio" &&
jQuery.nodeName( elem, "input" ) ) { jQuery.nodeName( elem, "input" ) ) {
// Setting the type on a radio button after the value resets the value in IE8-9
// Reset value to default in case type is set after value during creation
var val = elem.value; var val = elem.value;
elem.setAttribute( "type", value ); elem.setAttribute( "type", value );
if ( val ) { if ( val ) {
...@@ -98,10 +105,22 @@ jQuery.extend( { ...@@ -98,10 +105,22 @@ jQuery.extend( {
if ( jQuery.expr.match.bool.test( name ) ) { if ( jQuery.expr.match.bool.test( name ) ) {
// Set corresponding property to false // Set corresponding property to false
elem[ propName ] = false; if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
elem[ propName ] = false;
// Support: IE<9
// Also clear defaultChecked/defaultSelected (if appropriate)
} else {
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
}
// See #9699 for explanation of this approach (setting first, then removal)
} else {
jQuery.attr( elem, name, "" );
} }
elem.removeAttribute( name ); elem.removeAttribute( getSetAttribute ? name : propName );
} }
} }
} }
...@@ -114,29 +133,149 @@ boolHook = { ...@@ -114,29 +133,149 @@ boolHook = {
// Remove boolean attributes when set to false // Remove boolean attributes when set to false
jQuery.removeAttr( elem, name ); jQuery.removeAttr( elem, name );
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
// IE<8 needs the *property* name
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
} else { } else {
elem.setAttribute( name, name );
// Support: IE<9
// Use defaultChecked and defaultSelected for oldIE
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
} }
return name; return name;
} }
}; };
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
var getter = attrHandle[ name ] || jQuery.find.attr; var getter = attrHandle[ name ] || jQuery.find.attr;
attrHandle[ name ] = function( elem, name, isXML ) { if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
var ret, handle; attrHandle[ name ] = function( elem, name, isXML ) {
if ( !isXML ) { var ret, handle;
if ( !isXML ) {
// Avoid an infinite loop by temporarily removing this function from the getter
handle = attrHandle[ name ]; // Avoid an infinite loop by temporarily removing this function from the getter
attrHandle[ name ] = ret; handle = attrHandle[ name ];
ret = getter( elem, name, isXML ) != null ? attrHandle[ name ] = ret;
name.toLowerCase() : ret = getter( elem, name, isXML ) != null ?
null; name.toLowerCase() :
attrHandle[ name ] = handle; null;
attrHandle[ name ] = handle;
}
return ret;
};
} else {
attrHandle[ name ] = function( elem, name, isXML ) {
if ( !isXML ) {
return elem[ jQuery.camelCase( "default-" + name ) ] ?
name.toLowerCase() :
null;
}
};
}
} );
// fix oldIE attroperties
if ( !getSetInput || !getSetAttribute ) {
jQuery.attrHooks.value = {
set: function( elem, value, name ) {
if ( jQuery.nodeName( elem, "input" ) ) {
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
} }
return ret;
}; };
} ); }
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = {
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
( ret = elem.ownerDocument.createAttribute( name ) )
);
}
ret.value = value += "";
// Break association with cloned elements by also using setAttribute (#9646)
if ( name === "value" || value === elem.getAttribute( name ) ) {
return value;
}
}
};
// Some attributes are constructed with empty-string values when not defined
attrHandle.id = attrHandle.name = attrHandle.coords =
function( elem, name, isXML ) {
var ret;
if ( !isXML ) {
return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ?
ret.value :
null;
}
};
// Fixing value retrieval on a button requires this module
jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
if ( ret && ret.specified ) {
return ret.value;
}
},
set: nodeHook.set
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
set: function( elem, value, name ) {
nodeHook.set( elem, value === "" ? false : value, name );
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each( [ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
};
} );
}
if ( !support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Note: IE uppercases css property names, but if we were to .toLowerCase()
// .cssText, that would destroy case sensitivity in URL's, like in "background"
return elem.style.cssText || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
} ); } );
define( [ define( [
"../core", "../core",
"../var/rnotwhite", "../var/rnotwhite",
"../data/var/dataPriv",
"../core/init" "../core/init"
], function( jQuery, rnotwhite, dataPriv ) { ], function( jQuery, rnotwhite ) {
var rclass = /[\t\r\n\f]/g; var rclass = /[\t\r\n\f]/g;
function getClass( elem ) { function getClass( elem ) {
return elem.getAttribute && elem.getAttribute( "class" ) || ""; return jQuery.attr( elem, "class" ) || "";
} }
jQuery.fn.extend( { jQuery.fn.extend( {
...@@ -38,10 +37,10 @@ jQuery.fn.extend( { ...@@ -38,10 +37,10 @@ jQuery.fn.extend( {
} }
} }
// Only assign if different to avoid unneeded rendering. // only assign if different to avoid unneeded rendering.
finalValue = jQuery.trim( cur ); finalValue = jQuery.trim( cur );
if ( curValue !== finalValue ) { if ( curValue !== finalValue ) {
elem.setAttribute( "class", finalValue ); jQuery.attr( elem, "class", finalValue );
} }
} }
} }
...@@ -87,7 +86,7 @@ jQuery.fn.extend( { ...@@ -87,7 +86,7 @@ jQuery.fn.extend( {
// Only assign if different to avoid unneeded rendering. // Only assign if different to avoid unneeded rendering.
finalValue = jQuery.trim( cur ); finalValue = jQuery.trim( cur );
if ( curValue !== finalValue ) { if ( curValue !== finalValue ) {
elem.setAttribute( "class", finalValue ); jQuery.attr( elem, "class", finalValue );
} }
} }
} }
...@@ -137,21 +136,19 @@ jQuery.fn.extend( { ...@@ -137,21 +136,19 @@ jQuery.fn.extend( {
className = getClass( this ); className = getClass( this );
if ( className ) { if ( className ) {
// Store className if set // store className if set
dataPriv.set( this, "__className__", className ); jQuery._data( this, "__className__", className );
} }
// If the element has a class name or if we're passed `false`, // If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it). // then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything), // Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored. // falling back to the empty string if nothing was stored.
if ( this.setAttribute ) { jQuery.attr( this, "class",
this.setAttribute( "class", className || value === false ?
className || value === false ? "" :
"" : jQuery._data( this, "__className__" ) || ""
dataPriv.get( this, "__className__" ) || "" );
);
}
} }
} ); } );
}, },
......
...@@ -5,7 +5,7 @@ define( [ ...@@ -5,7 +5,7 @@ define( [
"../selector" "../selector"
], function( jQuery, access, support ) { ], function( jQuery, access, support ) {
var rfocusable = /^(?:input|select|textarea|button)$/i, var rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i; rclickable = /^(?:a|area)$/i;
jQuery.fn.extend( { jQuery.fn.extend( {
...@@ -14,8 +14,14 @@ jQuery.fn.extend( { ...@@ -14,8 +14,14 @@ jQuery.fn.extend( {
}, },
removeProp: function( name ) { removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each( function() { return this.each( function() {
delete this[ jQuery.propFix[ name ] || name ];
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch ( e ) {}
} ); } );
} }
} ); } );
...@@ -79,14 +85,50 @@ jQuery.extend( { ...@@ -79,14 +85,50 @@ jQuery.extend( {
} }
} ); } );
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !support.hrefNormalized ) {
// href/src property should get the full normalized URL (#10299/#12915)
jQuery.each( [ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
} );
}
// Support: Safari, IE9+
// Accessing the selectedIndex property
// forces the browser to respect setting selected
// on the option
// The getter ensures a default option is selected
// when in an optgroup
if ( !support.optSelected ) { if ( !support.optSelected ) {
jQuery.propHooks.selected = { jQuery.propHooks.selected = {
get: function( elem ) { get: function( elem ) {
var parent = elem.parentNode; var parent = elem.parentNode;
if ( parent && parent.parentNode ) {
parent.parentNode.selectedIndex; if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
} }
return null; return null;
},
set: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
} }
}; };
} }
...@@ -106,4 +148,9 @@ jQuery.each( [ ...@@ -106,4 +148,9 @@ jQuery.each( [
jQuery.propFix[ this.toLowerCase() ] = this; jQuery.propFix[ this.toLowerCase() ] = this;
} ); } );
// IE6/7 call enctype encoding
if ( !support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
} ); } );
...@@ -4,30 +4,64 @@ define( [ ...@@ -4,30 +4,64 @@ define( [
], function( document, support ) { ], function( document, support ) {
( function() { ( function() {
var input = document.createElement( "input" ), var a,
input = document.createElement( "input" ),
div = document.createElement( "div" ),
select = document.createElement( "select" ), select = document.createElement( "select" ),
opt = select.appendChild( document.createElement( "option" ) ); opt = select.appendChild( document.createElement( "option" ) );
input.type = "checkbox"; // Setup
div = document.createElement( "div" );
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
a = div.getElementsByTagName( "a" )[ 0 ];
// Support: iOS<=5.1, Android<=4.2+ // Support: Windows Web Apps (WWA)
// Default value for a checkbox should be "on" // `type` must use .setAttribute for WWA (#14901)
support.checkOn = input.value !== ""; input.setAttribute( "type", "checkbox" );
div.appendChild( input );
// Support: IE<=11+ a = div.getElementsByTagName( "a" )[ 0 ];
// Must access selectedIndex to make default options select
// First batch of tests.
a.style.cssText = "top:1px";
// Test setAttribute on camelCase class.
// If it works, we need attrFixes when doing get/setAttribute (ie6/7)
support.getSetAttribute = div.className !== "t";
// Get the style information from getAttribute
// (IE uses .cssText instead)
support.style = /top/.test( a.getAttribute( "style" ) );
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
support.hrefNormalized = a.getAttribute( "href" ) === "/a";
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
support.checkOn = !!input.value;
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
support.optSelected = opt.selected; support.optSelected = opt.selected;
// Support: Android<=2.3 // Tests for enctype support on a form (#6743)
// Options inside disabled selects are incorrectly marked as disabled support.enctype = !!document.createElement( "form" ).enctype;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true; select.disabled = true;
support.optDisabled = !opt.disabled; support.optDisabled = !opt.disabled;
// Support: IE<=11+ // Support: IE8 only
// An input loses its value after becoming a radio // Check if we can trust getAttribute("value")
input = document.createElement( "input" ); input = document.createElement( "input" );
input.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
// Check if an input maintains its value after becoming a radio
input.value = "t"; input.value = "t";
input.type = "radio"; input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t"; support.radioValue = input.value === "t";
} )(); } )();
......
...@@ -4,7 +4,8 @@ define( [ ...@@ -4,7 +4,8 @@ define( [
"../core/init" "../core/init"
], function( jQuery, support ) { ], function( jQuery, support ) {
var rreturn = /\r/g; var rreturn = /\r/g,
rspaces = /[\x20\t\r\n\f]+/g;
jQuery.fn.extend( { jQuery.fn.extend( {
val: function( value ) { val: function( value ) {
...@@ -16,7 +17,8 @@ jQuery.fn.extend( { ...@@ -16,7 +17,8 @@ jQuery.fn.extend( {
hooks = jQuery.valHooks[ elem.type ] || hooks = jQuery.valHooks[ elem.type ] ||
jQuery.valHooks[ elem.nodeName.toLowerCase() ]; jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && if (
hooks &&
"get" in hooks && "get" in hooks &&
( ret = hooks.get( elem, "value" ) ) !== undefined ( ret = hooks.get( elem, "value" ) ) !== undefined
) { ) {
...@@ -27,10 +29,10 @@ jQuery.fn.extend( { ...@@ -27,10 +29,10 @@ jQuery.fn.extend( {
return typeof ret === "string" ? return typeof ret === "string" ?
// Handle most common string cases // handle most common string cases
ret.replace( rreturn, "" ) : ret.replace( rreturn, "" ) :
// Handle cases where value is null/undef or number // handle cases where value is null/undef or number
ret == null ? "" : ret; ret == null ? "" : ret;
} }
...@@ -55,10 +57,8 @@ jQuery.fn.extend( { ...@@ -55,10 +57,8 @@ jQuery.fn.extend( {
// Treat null/undefined as ""; convert numbers to string // Treat null/undefined as ""; convert numbers to string
if ( val == null ) { if ( val == null ) {
val = ""; val = "";
} else if ( typeof val === "number" ) { } else if ( typeof val === "number" ) {
val += ""; val += "";
} else if ( jQuery.isArray( val ) ) { } else if ( jQuery.isArray( val ) ) {
val = jQuery.map( val, function( value ) { val = jQuery.map( val, function( value ) {
return value == null ? "" : value + ""; return value == null ? "" : value + "";
...@@ -79,10 +79,15 @@ jQuery.extend( { ...@@ -79,10 +79,15 @@ jQuery.extend( {
valHooks: { valHooks: {
option: { option: {
get: function( elem ) { get: function( elem ) {
var val = jQuery.find.attr( elem, "value" );
// Support: IE<11 return val != null ?
// option.value not trimmed (#14858) val :
return jQuery.trim( elem.value );
// Support: IE10-11+
// option.text throws exceptions (#14686, #14858)
// Strip and collapse whitespace
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
} }
}, },
select: { select: {
...@@ -101,12 +106,13 @@ jQuery.extend( { ...@@ -101,12 +106,13 @@ jQuery.extend( {
for ( ; i < max; i++ ) { for ( ; i < max; i++ ) {
option = options[ i ]; option = options[ i ];
// IE8-9 doesn't update selected after form reset (#2551) // oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) && if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup // Don't return options that are disabled or in a disabled optgroup
( support.optDisabled ? ( support.optDisabled ?
!option.disabled : option.getAttribute( "disabled" ) === null ) && !option.disabled :
option.getAttribute( "disabled" ) === null ) &&
( !option.parentNode.disabled || ( !option.parentNode.disabled ||
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
...@@ -134,10 +140,24 @@ jQuery.extend( { ...@@ -134,10 +140,24 @@ jQuery.extend( {
while ( i-- ) { while ( i-- ) {
option = options[ i ]; option = options[ i ];
if ( option.selected =
jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) {
) {
optionSet = true; // Support: IE6
// When new option element is added to select box we need to
// force reflow of newly added node in order to workaround delay
// of initialization properties
try {
option.selected = optionSet = true;
} catch ( _ ) {
// Will be executed only in IE6
option.scrollHeight;
}
} else {
option.selected = false;
} }
} }
...@@ -145,7 +165,8 @@ jQuery.extend( { ...@@ -145,7 +165,8 @@ jQuery.extend( {
if ( !optionSet ) { if ( !optionSet ) {
elem.selectedIndex = -1; elem.selectedIndex = -1;
} }
return values;
return options;
} }
} }
} }
......
...@@ -190,9 +190,9 @@ jQuery.Callbacks = function( options ) { ...@@ -190,9 +190,9 @@ jQuery.Callbacks = function( options ) {
// Also disable .add unless we have memory (since it would have no effect) // Also disable .add unless we have memory (since it would have no effect)
// Abort any pending executions // Abort any pending executions
lock: function() { lock: function() {
locked = queue = []; locked = true;
if ( !memory ) { if ( !memory ) {
list = memory = ""; self.disable();
} }
return this; return this;
}, },
......
define( [ define( [
"./var/arr", "./var/deletedIds",
"./var/document", "./var/document",
"./var/slice", "./var/slice",
"./var/concat", "./var/concat",
...@@ -9,7 +9,8 @@ define( [ ...@@ -9,7 +9,8 @@ define( [
"./var/toString", "./var/toString",
"./var/hasOwn", "./var/hasOwn",
"./var/support" "./var/support"
], function( arr, document, slice, concat, push, indexOf, class2type, toString, hasOwn, support ) { ], function( deletedIds, document, slice, concat, push, indexOf,
class2type, toString, hasOwn, support ) {
var var
version = "@VERSION", version = "@VERSION",
...@@ -22,7 +23,7 @@ var ...@@ -22,7 +23,7 @@ var
return new jQuery.fn.init( selector, context ); return new jQuery.fn.init( selector, context );
}, },
// Support: Android<4.1 // Support: Android<4.1, IE<9
// Make sure we trim BOM and NBSP // Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
...@@ -115,12 +116,12 @@ jQuery.fn = jQuery.prototype = { ...@@ -115,12 +116,12 @@ jQuery.fn = jQuery.prototype = {
// For internal use only. // For internal use only.
// Behaves like an Array's method, not like a jQuery method. // Behaves like an Array's method, not like a jQuery method.
push: push, push: push,
sort: arr.sort, sort: deletedIds.sort,
splice: arr.splice splice: deletedIds.splice
}; };
jQuery.extend = jQuery.fn.extend = function() { jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone, var src, copyIsArray, copy, name, options, clone,
target = arguments[ 0 ] || {}, target = arguments[ 0 ] || {},
i = 1, i = 1,
length = arguments.length, length = arguments.length,
...@@ -130,7 +131,7 @@ jQuery.extend = jQuery.fn.extend = function() { ...@@ -130,7 +131,7 @@ jQuery.extend = jQuery.fn.extend = function() {
if ( typeof target === "boolean" ) { if ( typeof target === "boolean" ) {
deep = target; deep = target;
// Skip the boolean and the target // skip the boolean and the target
target = arguments[ i ] || {}; target = arguments[ i ] || {};
i++; i++;
} }
...@@ -140,7 +141,7 @@ jQuery.extend = jQuery.fn.extend = function() { ...@@ -140,7 +141,7 @@ jQuery.extend = jQuery.fn.extend = function() {
target = {}; target = {};
} }
// Extend jQuery itself if only one argument is passed // extend jQuery itself if only one argument is passed
if ( i === length ) { if ( i === length ) {
target = this; target = this;
i--; i--;
...@@ -202,14 +203,20 @@ jQuery.extend( { ...@@ -202,14 +203,20 @@ jQuery.extend( {
noop: function() {}, noop: function() {},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) { isFunction: function( obj ) {
return jQuery.type( obj ) === "function"; return jQuery.type( obj ) === "function";
}, },
isArray: Array.isArray, isArray: Array.isArray || function( obj ) {
return jQuery.type( obj ) === "array";
},
isWindow: function( obj ) { isWindow: function( obj ) {
return obj != null && obj === obj.window; /* jshint eqeqeq: false */
return obj != null && obj == obj.window;
}, },
isNumeric: function( obj ) { isNumeric: function( obj ) {
...@@ -222,73 +229,77 @@ jQuery.extend( { ...@@ -222,73 +229,77 @@ jQuery.extend( {
return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
}, },
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
isPlainObject: function( obj ) { isPlainObject: function( obj ) {
var key;
// Not plain objects: // Must be an Object.
// - Any object or value whose internal [[Class]] property is not "[object Object]" // Because of IE, we also have to check the presence of the constructor property.
// - DOM nodes // Make sure that DOM nodes and window objects don't pass through, as well
// - window if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false; return false;
} }
if ( obj.constructor && try {
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call( obj, "constructor" ) &&
!hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false; return false;
} }
// If the function hasn't returned already, we're confident that // Support: IE<9
// |obj| is a plain object, created by {} or constructed with new Object // Handle iteration over inherited properties before own properties.
return true; if ( !support.ownFirst ) {
}, for ( key in obj ) {
return hasOwn.call( obj, key );
isEmptyObject: function( obj ) { }
var name;
for ( name in obj ) {
return false;
} }
return true;
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
}, },
type: function( obj ) { type: function( obj ) {
if ( obj == null ) { if ( obj == null ) {
return obj + ""; return obj + "";
} }
// Support: Android<4.0, iOS<6 (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ? return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" : class2type[ toString.call( obj ) ] || "object" :
typeof obj; typeof obj;
}, },
// Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll
globalEval: function( code ) { // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
var script, globalEval: function( data ) {
indirect = eval; if ( data && jQuery.trim( data ) ) {
code = jQuery.trim( code ); // We use execScript on Internet Explorer
// We use an anonymous function so that context is window
if ( code ) { // rather than jQuery in Firefox
( window.execScript || function( data ) {
// If the code includes a valid, prologue position window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation
// strict mode pragma, execute code by injecting a } )( data );
// script tag into the document.
if ( code.indexOf( "use strict" ) === 1 ) {
script = document.createElement( "script" );
script.text = code;
document.head.appendChild( script ).parentNode.removeChild( script );
} else {
// Otherwise, avoid the DOM node creation, insertion
// and removal by using an indirect global eval
indirect( code );
}
} }
}, },
// Convert dashed to camelCase; used by the css and data modules // Convert dashed to camelCase; used by the css and data modules
// Support: IE9-11+
// Microsoft forgot to hump their vendor prefix (#9572) // Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) { camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
...@@ -319,7 +330,7 @@ jQuery.extend( { ...@@ -319,7 +330,7 @@ jQuery.extend( {
return obj; return obj;
}, },
// Support: Android<4.1 // Support: Android<4.1, IE<9
trim: function( text ) { trim: function( text ) {
return text == null ? return text == null ?
"" : "" :
...@@ -345,7 +356,26 @@ jQuery.extend( { ...@@ -345,7 +356,26 @@ jQuery.extend( {
}, },
inArray: function( elem, arr, i ) { inArray: function( elem, arr, i ) {
return arr == null ? -1 : indexOf.call( arr, elem, i ); var len;
if ( arr ) {
if ( indexOf ) {
return indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
}, },
merge: function( first, second ) { merge: function( first, second ) {
...@@ -353,8 +383,16 @@ jQuery.extend( { ...@@ -353,8 +383,16 @@ jQuery.extend( {
j = 0, j = 0,
i = first.length; i = first.length;
for ( ; j < len; j++ ) { while ( j < len ) {
first[ i++ ] = second[ j ]; first[ i++ ] = second[ j++ ];
}
// Support: IE<9
// Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
if ( len !== len ) {
while ( second[ j ] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
} }
first.length = i; first.length = i;
...@@ -419,7 +457,7 @@ jQuery.extend( { ...@@ -419,7 +457,7 @@ jQuery.extend( {
// Bind a function to a context, optionally partially applying any // Bind a function to a context, optionally partially applying any
// arguments. // arguments.
proxy: function( fn, context ) { proxy: function( fn, context ) {
var tmp, args, proxy; var args, proxy, tmp;
if ( typeof context === "string" ) { if ( typeof context === "string" ) {
tmp = fn[ context ]; tmp = fn[ context ];
...@@ -445,7 +483,9 @@ jQuery.extend( { ...@@ -445,7 +483,9 @@ jQuery.extend( {
return proxy; return proxy;
}, },
now: Date.now, now: function() {
return +( new Date() );
},
// jQuery.support is not used in Core but other projects attach their // jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist. // properties to it so it needs to exist.
...@@ -458,7 +498,7 @@ jQuery.extend( { ...@@ -458,7 +498,7 @@ jQuery.extend( {
// three lines. // three lines.
/* jshint ignore: start */ /* jshint ignore: start */
if ( typeof Symbol === "function" ) { if ( typeof Symbol === "function" ) {
jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
} }
/* jshint ignore: end */ /* jshint ignore: end */
......
...@@ -6,7 +6,7 @@ define( [ ...@@ -6,7 +6,7 @@ define( [
// The value/s can optionally be executed if it's a function // The value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0, var i = 0,
len = elems.length, length = elems.length,
bulk = key == null; bulk = key == null;
// Sets many values // Sets many values
...@@ -41,11 +41,11 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { ...@@ -41,11 +41,11 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
} }
if ( fn ) { if ( fn ) {
for ( ; i < len; i++ ) { for ( ; i < length; i++ ) {
fn( fn(
elems[ i ], key, raw ? elems[ i ],
value : key,
value.call( elems[ i ], i, fn( elems[ i ], key ) ) raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) )
); );
} }
} }
...@@ -57,7 +57,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { ...@@ -57,7 +57,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
// Gets // Gets
bulk ? bulk ?
fn.call( elems ) : fn.call( elems ) :
len ? fn( elems[ 0 ], key ) : emptyGet; length ? fn( elems[ 0 ], key ) : emptyGet;
}; };
return access; return access;
......
...@@ -22,14 +22,14 @@ var rootjQuery, ...@@ -22,14 +22,14 @@ var rootjQuery,
return this; return this;
} }
// Method init() accepts an alternate rootjQuery // init accepts an alternate rootjQuery
// so migrate can support jQuery.sub (gh-2101) // so migrate can support jQuery.sub (gh-2101)
root = root || rootjQuery; root = root || rootjQuery;
// Handle HTML strings // Handle HTML strings
if ( typeof selector === "string" ) { if ( typeof selector === "string" ) {
if ( selector[ 0 ] === "<" && if ( selector.charAt( 0 ) === "<" &&
selector[ selector.length - 1 ] === ">" && selector.charAt( selector.length - 1 ) === ">" &&
selector.length >= 3 ) { selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check // Assume that strings that start and end with <> are HTML and skip the regex check
...@@ -46,7 +46,7 @@ var rootjQuery, ...@@ -46,7 +46,7 @@ var rootjQuery,
if ( match[ 1 ] ) { if ( match[ 1 ] ) {
context = context instanceof jQuery ? context[ 0 ] : context; context = context instanceof jQuery ? context[ 0 ] : context;
// Option to run scripts is true for back-compat // scripts is true for back-compat
// Intentionally let the error be thrown if parseHTML is not present // Intentionally let the error be thrown if parseHTML is not present
jQuery.merge( this, jQuery.parseHTML( jQuery.merge( this, jQuery.parseHTML(
match[ 1 ], match[ 1 ],
...@@ -75,11 +75,17 @@ var rootjQuery, ...@@ -75,11 +75,17 @@ var rootjQuery,
} else { } else {
elem = document.getElementById( match[ 2 ] ); elem = document.getElementById( match[ 2 ] );
// Support: Blackberry 4.6 // Check parentNode to catch when Blackberry 4.6 returns
// gEBID returns nodes no longer in the document (#6963) // nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) { if ( elem && elem.parentNode ) {
// Inject the element directly into the jQuery object // Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[ 2 ] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1; this.length = 1;
this[ 0 ] = elem; this[ 0 ] = elem;
} }
...@@ -108,7 +114,7 @@ var rootjQuery, ...@@ -108,7 +114,7 @@ var rootjQuery,
// HANDLE: $(function) // HANDLE: $(function)
// Shortcut for document ready // Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) { } else if ( jQuery.isFunction( selector ) ) {
return root.ready !== undefined ? return typeof root.ready !== "undefined" ?
root.ready( selector ) : root.ready( selector ) :
// Execute immediately if ready is not present // Execute immediately if ready is not present
......
...@@ -2,13 +2,10 @@ define( [ ...@@ -2,13 +2,10 @@ define( [
"../core", "../core",
"../var/document", "../var/document",
"./var/rsingleTag", "./var/rsingleTag",
"../manipulation/buildFragment", "../manipulation/buildFragment"
], function( jQuery, document, rsingleTag, buildFragment ) {
// This is the only module that needs core/support // data: string of html
"./support"
], function( jQuery, document, rsingleTag, buildFragment, support ) {
// Argument "data" should be string of html
// context (optional): If specified, the fragment will be created in this context, // context (optional): If specified, the fragment will be created in this context,
// defaults to document // defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string // keepScripts (optional): If true, will include scripts passed in the html string
...@@ -20,12 +17,7 @@ jQuery.parseHTML = function( data, context, keepScripts ) { ...@@ -20,12 +17,7 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
keepScripts = context; keepScripts = context;
context = false; context = false;
} }
context = context || document;
// Stop scripts or inline event handlers from being executed immediately
// by using document.implementation
context = context || ( support.createHTMLDocument ?
document.implementation.createHTMLDocument( "" ) :
document );
var parsed = rsingleTag.exec( data ), var parsed = rsingleTag.exec( data ),
scripts = !keepScripts && []; scripts = !keepScripts && [];
......
...@@ -61,13 +61,33 @@ jQuery.extend( { ...@@ -61,13 +61,33 @@ jQuery.extend( {
} }
} ); } );
/**
* Clean-up method for dom ready events
*/
function detach() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed );
window.removeEventListener( "load", completed );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
}
/** /**
* The ready event handler and self cleanup method * The ready event handler and self cleanup method
*/ */
function completed() { function completed() {
document.removeEventListener( "DOMContentLoaded", completed );
window.removeEventListener( "load", completed ); // readyState === "complete" is good enough for us to call the dom ready in oldIE
jQuery.ready(); if ( document.addEventListener ||
window.event.type === "load" ||
document.readyState === "complete" ) {
detach();
jQuery.ready();
}
} }
jQuery.ready.promise = function( obj ) { jQuery.ready.promise = function( obj ) {
...@@ -77,7 +97,7 @@ jQuery.ready.promise = function( obj ) { ...@@ -77,7 +97,7 @@ jQuery.ready.promise = function( obj ) {
// Catch cases where $(document).ready() is called // Catch cases where $(document).ready() is called
// after the browser event has already occurred. // after the browser event has already occurred.
// Support: IE9-10 only // Support: IE6-10
// Older IE sometimes signals "interactive" too soon // Older IE sometimes signals "interactive" too soon
if ( document.readyState === "complete" || if ( document.readyState === "complete" ||
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
...@@ -85,13 +105,53 @@ jQuery.ready.promise = function( obj ) { ...@@ -85,13 +105,53 @@ jQuery.ready.promise = function( obj ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready // Handle it asynchronously to allow scripts the opportunity to delay ready
window.setTimeout( jQuery.ready ); window.setTimeout( jQuery.ready );
} else { // Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback // Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed ); document.addEventListener( "DOMContentLoaded", completed );
// A fallback to window.onload, that will always work // A fallback to window.onload, that will always work
window.addEventListener( "load", completed ); window.addEventListener( "load", completed );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch ( e ) {}
if ( top && top.doScroll ) {
( function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll( "left" );
} catch ( e ) {
return window.setTimeout( doScrollCheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jQuery.ready();
}
} )();
}
} }
} }
return readyList.promise( obj ); return readyList.promise( obj );
......
This diff is collapsed.
define( [ define( [
"exports",
"../core", "../core",
"../var/documentElement",
"./var/rnumnonpx", "./var/rnumnonpx",
"./var/rmargin", "./var/rmargin",
"./var/getStyles",
"./support", "./support",
"../selector" // Get jQuery.contains "../selector" // contains
], function( jQuery, rnumnonpx, rmargin, getStyles, support ) { ], function( exports, jQuery, documentElement, rnumnonpx, rmargin, support ) {
function curCSS( elem, name, computed ) { var getStyles, curCSS,
var width, minWidth, maxWidth, ret, rposition = /^(top|right|bottom|left)$/;
style = elem.style;
if ( window.getComputedStyle ) {
computed = computed || getStyles( elem ); getStyles = function( elem ) {
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
// Support: IE<=11+, Firefox<=30+ (#15098, #14150)
// Support: Opera 12.1x only // IE throws on elements created in popups
// Fall back to style even without computed // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
// computed is undefined for elems on document fragments var view = elem.ownerDocument.defaultView;
if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name ); if ( !view || !view.opener ) {
} view = window;
}
// Support: IE9
// getPropertyValue is only needed for .css('filter') (#12537) return view.getComputedStyle( elem );
if ( computed ) { };
// A tribute to the "awesome hack by Dean Edwards" curCSS = function( elem, name, computed ) {
// Android Browser returns percentage for some values, var width, minWidth, maxWidth, ret,
// but width seems to be reliably pixels. style = elem.style;
// This is against the CSSOM draft spec:
// http://dev.w3.org/csswg/cssom/#resolved-values computed = computed || getStyles( elem );
if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
// Support: Opera 12.1x only
// Fall back to style even without computed
// computed is undefined for elems on document fragments
if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
if ( computed ) {
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value"
// instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values,
// but width seems to be reliably pixels
// this is against the CSSOM draft spec:
// http://dev.w3.org/csswg/cssom/#resolved-values
if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
// Support: IE
// IE returns zIndex value as an integer.
return ret === undefined ?
ret :
ret + "";
};
} else if ( documentElement.currentStyle ) {
getStyles = function( elem ) {
return elem.currentStyle;
};
curCSS = function( elem, name, computed ) {
var left, rs, rsLeft, ret,
style = elem.style;
computed = computed || getStyles( elem );
ret = computed ? computed[ name ] : undefined;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are
// proportional to the parent element instead
// and we can't measure the parent instead because it
// might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values // Remember the original values
width = style.width; left = style.left;
minWidth = style.minWidth; rs = elem.runtimeStyle;
maxWidth = style.maxWidth; rsLeft = rs && rs.left;
// Put in the new values to get a computed value out // Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret; if ( rsLeft ) {
ret = computed.width; rs.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values // Revert the changed values
style.width = width; style.left = left;
style.minWidth = minWidth; if ( rsLeft ) {
style.maxWidth = maxWidth; rs.left = rsLeft;
}
} }
}
return ret !== undefined ?
// Support: IE9-11+ // Support: IE
// IE returns zIndex value as an integer. // IE returns zIndex value as an integer.
ret + "" : return ret === undefined ?
ret; ret :
ret + "" || "auto";
};
} }
return curCSS; exports.getStyles = getStyles;
exports.curCSS = curCSS;
} ); } );
...@@ -51,7 +51,7 @@ function defaultDisplay( nodeName ) { ...@@ -51,7 +51,7 @@ function defaultDisplay( nodeName ) {
.appendTo( doc.documentElement ); .appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = iframe[ 0 ].contentDocument; doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
// Support: IE // Support: IE
doc.write(); doc.write();
......
define( [ define( [
"../core", "../core",
"../selector" "./support",
], function( jQuery ) { "../selector",
"../css"
], function( jQuery, support ) {
function getDisplay( elem ) {
return elem.style && elem.style.display || jQuery.css( elem, "display" );
}
function filterHidden( elem ) {
while ( elem && elem.nodeType === 1 ) {
if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) {
return true;
}
elem = elem.parentNode;
}
return false;
}
jQuery.expr.filters.hidden = function( elem ) { jQuery.expr.filters.hidden = function( elem ) {
return !jQuery.expr.filters.visible( elem );
};
jQuery.expr.filters.visible = function( elem ) {
// Support: Opera <= 12.12 // Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements // Opera reports offsetWidths and offsetHeights less than zero on some elements
// Use OR instead of AND as the element is not visible if either is true return support.reliableHiddenOffsets() ?
// See tickets #10406 and #13132 ( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 &&
return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0; !elem.getClientRects().length ) :
filterHidden( elem );
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
}; };
} ); } );
define( [ define( [], function() {
"../data/var/dataPriv"
], function( dataPriv ) {
function showHide( elements, show ) { function showHide( elements, show ) {
var display, elem, var display, elem,
values = [], values = [],
...@@ -20,14 +17,14 @@ function showHide( elements, show ) { ...@@ -20,14 +17,14 @@ function showHide( elements, show ) {
if ( display === "none" ) { if ( display === "none" ) {
// Restore a pre-hide() value if we have one // Restore a pre-hide() value if we have one
values[ index ] = dataPriv.get( elem, "display" ) || ""; values[ index ] = jQuery._data( elem, "display" ) || "";
} }
} else { } else {
if ( display !== "none" ) { if ( display !== "none" ) {
values[ index ] = "none"; values[ index ] = "none";
// Remember the value we're replacing // Remember the value we're replacing
dataPriv.set( elem, "display", display ); jQuery._data( elem, "display", display );
} }
} }
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -120,6 +120,7 @@ jQuery.extend( { ...@@ -120,6 +120,7 @@ jQuery.extend( {
values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
if ( values === progressValues ) { if ( values === progressValues ) {
deferred.notifyWith( contexts, values ); deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) { } else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values ); deferred.resolveWith( contexts, values );
} }
...@@ -128,7 +129,7 @@ jQuery.extend( { ...@@ -128,7 +129,7 @@ jQuery.extend( {
progressValues, progressContexts, resolveContexts; progressValues, progressContexts, resolveContexts;
// Add listeners to Deferred subordinates; treat others as resolved // add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) { if ( length > 1 ) {
progressValues = new Array( length ); progressValues = new Array( length );
progressContexts = new Array( length ); progressContexts = new Array( length );
...@@ -145,7 +146,7 @@ jQuery.extend( { ...@@ -145,7 +146,7 @@ jQuery.extend( {
} }
} }
// If we're not waiting on anything, resolve the master // if we're not waiting on anything, resolve the master
if ( !remaining ) { if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues ); deferred.resolveWith( resolveContexts, resolveValues );
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment