Commit af22a351 authored by Timmy Willison's avatar Timmy Willison

Release 2.2.3

parent 3a43d7e5
...@@ -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@googlemail.com> Klaus Hartl <klaus.hartl@gmail.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@googlemail.com> Paul Bakaus <paul.bakaus@gmail.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@pixelgraphics.us> Douglas Neiner <doug@dougneiner.com>
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 <colin@alpha.zetafleet.com> Colin Snover <github.com@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 <scott@scottjehl.com> Scott Jehl <scottjehl@gmail.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 <gnarf@gnarf.net> Corey Frang <gnarf37@gmail.com>
Digitalxero <digitalxero> Digitalxero <digitalxero>
Anton Kovalyov <anton@kovalyov.net> Anton Kovalyov <anton@kovalyov.net>
David Murdoch <musicisair@yahoo.com> David Murdoch <david@davidmurdoch.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 <wwalser@atlassian.com> Wesley Walser <waw325@gmail.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,6 +170,8 @@ Paul Ramos <paul.b.ramos@gmail.com> ...@@ -170,6 +170,8 @@ 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>
...@@ -177,62 +179,70 @@ Jean Boussier <jean.boussier@gmail.com> ...@@ -177,62 +179,70 @@ 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>
Nguyen Phuc Lam <ruado1987@gmail.com> Li Xudong <istonelee@gmail.com>
Steven Benner <admin@stevenbenner.com>
Tom H Fuertes <tomfuertes@gmail.com> Tom H Fuertes <tomfuertes@gmail.com>
Brandon Johnson <bjohn465+github@gmail.com> Renato Oliveira dos Santos <ros3@cin.ufpe.br>
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>
Marian Sollmann <marian.sollmann@cargomedia.ch>
Corey Frang <gnarf37@gmail.com>
Chris Antaki <ChrisAntaki@gmail.com> Chris Antaki <ChrisAntaki@gmail.com>
Noah Hamann <njhamann@gmail.com> Marian Sollmann <marian.sollmann@cargomedia.ch>
njhamann <njhamann@gmail.com>
Ilya Kantor <iliakan@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 <christopherjonesqed@gmail.com> Christopher Jones <chris@cjqed.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>
Jason Bedard <jason+github@jbedard.ca> Frederic Hemberger <mail@frederic-hemberger.de>
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>
...@@ -246,20 +256,22 @@ Calvin Metcalf <calvin.metcalf@gmail.com> ...@@ -246,20 +256,22 @@ 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>
Joelle Fleurantin <joasqueeniebee@gmail.com>
Julian Alexander Murillo <julian.alexander.murillo@gmail.com> Julian Alexander Murillo <julian.alexander.murillo@gmail.com>
Joelle Fleurantin <joasqueeniebee@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 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.
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": "1.12.3", "version": "2.2.3",
"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/1.12-stable/AUTHORS.txt" "url": "https://github.com/jquery/jquery/blob/2.2.3/AUTHORS.txt"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
...@@ -41,11 +41,10 @@ ...@@ -41,11 +41,10 @@
"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.12.2", "sinon": "1.10.3",
"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",
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
"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
...@@ -23,8 +22,8 @@ ...@@ -23,8 +22,8 @@
"JSON": false, "JSON": false,
"jQuery": true, "jQuery": true,
"define": false, "define": true,
"module": false, "module": true,
"noGlobal": true "noGlobal": true
} }
} }
...@@ -9,21 +9,19 @@ define( [ ...@@ -9,21 +9,19 @@ 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)
...@@ -46,11 +44,9 @@ var ...@@ -46,11 +44,9 @@ 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( "*" ),
// Document location // Anchor tag for parsing the document origin
ajaxLocation = location.href, originAnchor = document.createElement( "a" );
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 ) {
...@@ -73,7 +69,7 @@ function addToPrefiltersOrTransports( structure ) { ...@@ -73,7 +69,7 @@ function addToPrefiltersOrTransports( structure ) {
while ( ( dataType = dataTypes[ i++ ] ) ) { while ( ( dataType = dataTypes[ i++ ] ) ) {
// Prepend if requested // Prepend if requested
if ( dataType.charAt( 0 ) === "+" ) { if ( dataType[ 0 ] === "+" ) {
dataType = dataType.slice( 1 ) || "*"; dataType = dataType.slice( 1 ) || "*";
( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
...@@ -117,7 +113,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX ...@@ -117,7 +113,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 deep, key, var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {}; flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) { for ( key in src ) {
...@@ -137,7 +133,8 @@ function ajaxExtend( target, src ) { ...@@ -137,7 +133,8 @@ 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;
...@@ -226,7 +223,7 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) { ...@@ -226,7 +223,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;
...@@ -269,7 +266,7 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) { ...@@ -269,7 +266,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" ] ) { // jscs:ignore requireDotNotation if ( conv && s.throws ) {
response = conv( response ); response = conv( response );
} else { } else {
try { try {
...@@ -299,9 +296,9 @@ jQuery.extend( { ...@@ -299,9 +296,9 @@ jQuery.extend( {
etag: {}, etag: {},
ajaxSettings: { ajaxSettings: {
url: ajaxLocation, url: location.href,
type: "GET", type: "GET",
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), isLocal: rlocalProtocol.test( location.protocol ),
global: true, global: true,
processData: true, processData: true,
async: true, async: true,
...@@ -393,30 +390,26 @@ jQuery.extend( { ...@@ -393,30 +390,26 @@ jQuery.extend( {
// Force options to be an object // Force options to be an object
options = options || {}; options = options || {};
var var transport,
// Cross-domain detection vars
parts,
// Loop variable
i,
// URL without anti-cache param // URL without anti-cache param
cacheURL, cacheURL,
// Response headers as string // Response headers
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,
transport, // Loop variable
i,
// Response headers
responseHeaders,
// Create the final options object // Create the final options object
s = jQuery.ajaxSetup( {}, options ), s = jQuery.ajaxSetup( {}, options ),
...@@ -525,12 +518,11 @@ jQuery.extend( { ...@@ -525,12 +518,11 @@ 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 (#5866: IE7 issue with protocol-less urls) // Add protocol if not provided (prefilters might expect it)
// 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 || ajaxLocation ) + "" ) s.url = ( ( url || s.url || location.href ) + "" ).replace( rhash, "" )
.replace( rhash, "" ) .replace( rprotocol, location.protocol + "//" );
.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;
...@@ -538,14 +530,26 @@ jQuery.extend( { ...@@ -538,14 +530,26 @@ 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 we have a protocol:host:port mismatch // A cross-domain request is in order when the origin doesn't match the current origin.
if ( s.crossDomain == null ) { if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() ); urlAnchor = document.createElement( "a" );
s.crossDomain = !!( parts &&
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || // Support: IE8-11+
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== // IE throws exception if url is malformed, e.g. http://example.com:80x/
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) try {
); 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
...@@ -640,7 +644,7 @@ jQuery.extend( { ...@@ -640,7 +644,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
...@@ -761,8 +765,7 @@ jQuery.extend( { ...@@ -761,8 +765,7 @@ jQuery.extend( {
} }
} else { } else {
// We extract error from statusText // Extract error from statusText and normalize for non-aborts
// then normalize statusText and status for non-aborts
error = statusText; error = statusText;
if ( status || !statusText ) { if ( status || !statusText ) {
statusText = "error"; statusText = "error";
...@@ -820,7 +823,7 @@ jQuery.extend( { ...@@ -820,7 +823,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, url.length ) ); selector = jQuery.trim( url.slice( off ) );
url = url.slice( 0, off ); url = url.slice( 0, off );
} }
......
...@@ -2,50 +2,10 @@ define( [ ...@@ -2,50 +2,10 @@ define( [
"../core" "../core"
], function( jQuery ) { ], function( jQuery ) {
var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; // Support: Android 2.3
// 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,23 +4,19 @@ define( [ ...@@ -4,23 +4,19 @@ define( [
// Cross-browser xml parsing // Cross-browser xml parsing
jQuery.parseXML = function( data ) { jQuery.parseXML = function( data ) {
var xml, tmp; var xml;
if ( !data || typeof data !== "string" ) { if ( !data || typeof data !== "string" ) {
return null; return null;
} }
// Support: IE9
try { try {
if ( window.DOMParser ) { // Standard xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
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;
......
...@@ -21,14 +21,13 @@ jQuery.ajaxSetup( { ...@@ -21,14 +21,13 @@ jQuery.ajaxSetup( {
} }
} ); } );
// Handle cache's special case and global // Handle cache's special case and crossDomain
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;
} }
} ); } );
...@@ -37,55 +36,29 @@ jQuery.ajaxTransport( "script", function( s ) { ...@@ -37,55 +36,29 @@ 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 ) {
send: function( _, callback ) { script = jQuery( "<script>" ).prop( {
charset: s.scriptCharset,
script = document.createElement( "script" ); src: s.url
} ).on(
script.async = true; "load error",
callback = function( evt ) {
if ( s.scriptCharset ) { script.remove();
script.charset = s.scriptCharset; callback = null;
} 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
head.insertBefore( script, head.firstChild ); document.head.appendChild( script[ 0 ] );
}, },
abort: function() { abort: function() {
if ( script ) { if ( callback ) {
script.onload( undefined, true ); callback();
} }
} }
}; };
......
define( [ define( [
"../core", "../core",
"../var/document",
"../var/support", "../var/support",
"../ajax" "../ajax"
], function( jQuery, document, support ) { ], function( jQuery, support ) {
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ?
// Support: IE6-IE8
function() {
// XHR cannot access local files, always use ActiveX for that case
if ( this.isLocal ) {
return createActiveXHR();
}
// Support: IE 9-11
// IE seems to error on cross-domain PATCH requests when ActiveX XHR
// is used. In IE 9+ always use the native XHR.
// Note: this condition won't catch Edge as it doesn't define
// document.documentMode but it also doesn't support ActiveX so it won't
// reach this code.
if ( document.documentMode > 8 ) {
return createStandardXHR();
}
// Support: IE<9
// oldIE XHR does not support non-RFC2616 methods (#13240)
// See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
// and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
// Although this check for six methods instead of eight
// since IE also does not support "trace" and "connect"
return /^(get|post|head|put|delete|options)$/i.test( this.type ) &&
createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
var xhrId = 0,
xhrCallbacks = {},
xhrSupported = jQuery.ajaxSettings.xhr();
// Support: IE<10
// Open requests must be manually aborted on unload (#5280)
// See https://support.microsoft.com/kb/2856746 for more info
if ( window.attachEvent ) {
window.attachEvent( "onunload", function() {
for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( undefined, true );
}
} );
}
// Determine support properties
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
xhrSupported = support.ajax = !!xhrSupported;
// Create transport if the browser can provide an xhr
if ( xhrSupported ) {
jQuery.ajaxTransport( function( options ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !options.crossDomain || support.cors ) {
var callback; jQuery.ajaxSettings.xhr = function() {
try {
return { return new window.XMLHttpRequest();
send: function( headers, complete ) { } catch ( e ) {}
var i, };
xhr = options.xhr(),
id = ++xhrId;
// Open the socket var xhrSuccessStatus = {
xhr.open(
options.type,
options.url,
options.async,
options.username,
options.password
);
// Apply custom fields if provided // File protocol always yields status code 0, assume 200
if ( options.xhrFields ) { 0: 200,
for ( i in options.xhrFields ) {
xhr[ i ] = options.xhrFields[ i ];
}
}
// Override mime type if needed // Support: IE9
if ( options.mimeType && xhr.overrideMimeType ) { // #1450: sometimes IE returns 1223 when it should be 204
xhr.overrideMimeType( options.mimeType ); 1223: 204
} },
xhrSupported = jQuery.ajaxSettings.xhr();
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Set headers support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
for ( i in headers ) { support.ajax = xhrSupported = !!xhrSupported;
// Support: IE<9 jQuery.ajaxTransport( function( options ) {
// IE's ActiveXObject throws a 'Type Mismatch' exception when setting var callback, errorCallback;
// request header to a null-value.
// // Cross domain only allowed if supported through XMLHttpRequest
// To keep consistent with other XHR implementations, cast the value if ( support.cors || xhrSupported && !options.crossDomain ) {
// to string and ignore `undefined`. return {
if ( headers[ i ] !== undefined ) { send: function( headers, complete ) {
xhr.setRequestHeader( i, headers[ i ] + "" ); var i,
} xhr = options.xhr();
xhr.open(
options.type,
options.url,
options.async,
options.username,
options.password
);
// Apply custom fields if provided
if ( options.xhrFields ) {
for ( i in options.xhrFields ) {
xhr[ i ] = options.xhrFields[ i ];
} }
}
// Do send the request // Override mime type if needed
// This may raise an exception which is actually if ( options.mimeType && xhr.overrideMimeType ) {
// handled in jQuery.ajax (so no try/catch here) xhr.overrideMimeType( options.mimeType );
xhr.send( ( options.hasContent && options.data ) || null ); }
// Listener
callback = function( _, isAbort ) {
var status, statusText, responses;
// Was never called and is aborted or complete // X-Requested-With header
if ( callback && ( isAbort || xhr.readyState === 4 ) ) { // For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Clean up // Set headers
delete xhrCallbacks[ id ]; for ( i in headers ) {
callback = undefined; xhr.setRequestHeader( i, headers[ i ] );
xhr.onreadystatechange = jQuery.noop; }
// Abort manually if needed // Callback
if ( isAbort ) { callback = function( type ) {
if ( xhr.readyState !== 4 ) { return function() {
xhr.abort(); if ( callback ) {
callback = errorCallback = xhr.onload =
xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
if ( type === "abort" ) {
xhr.abort();
} else if ( type === "error" ) {
// Support: IE9
// On a manual native abort, IE9 throws
// errors on any property access that is not readyState
if ( typeof xhr.status !== "number" ) {
complete( 0, "error" );
} else {
complete(
// File: protocol always yields status 0; see #8605, #14207
xhr.status,
xhr.statusText
);
} }
} else { } else {
responses = {}; complete(
status = xhr.status; xhrSuccessStatus[ xhr.status ] || xhr.status,
xhr.statusText,
// Support: IE<10
// Accessing binary-data responseText throws an exception // Support: IE9 only
// (#11426) // IE9 has no XHR2 but throws on binary (trac-11426)
if ( typeof xhr.responseText === "string" ) { // For XHR2 non-text, let the caller handle it (gh-2498)
responses.text = xhr.responseText; ( xhr.responseType || "text" ) !== "text" ||
} typeof xhr.responseText !== "string" ?
{ binary: xhr.response } :
// Firefox throws an exception when accessing { text: xhr.responseText },
// statusText for faulty cross-domain requests xhr.getAllResponseHeaders()
try { );
statusText = xhr.statusText;
} catch ( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && options.isLocal && !options.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
} }
} }
};
// Call complete if needed };
if ( responses ) {
complete( status, statusText, responses, xhr.getAllResponseHeaders() ); // Listen to events
xhr.onload = callback();
errorCallback = xhr.onerror = callback( "error" );
// Support: IE9
// Use onreadystatechange to replace onabort
// to handle uncaught aborts
if ( xhr.onabort !== undefined ) {
xhr.onabort = errorCallback;
} else {
xhr.onreadystatechange = function() {
// Check readyState before timeout as it changes
if ( xhr.readyState === 4 ) {
// Allow onerror to be called first,
// but that will not handle a native abort
// Also, save errorCallback to a variable
// as xhr.onerror cannot be accessed
window.setTimeout( function() {
if ( callback ) {
errorCallback();
}
} );
} }
}; };
}
// Do send the request // Create the abort callback
// `xhr.send` may raise an exception, but it will be callback = callback( "abort" );
// handled in jQuery.ajax (so no try/catch here)
if ( !options.async ) {
// If we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been try {
// retrieved directly we need to fire the callback
window.setTimeout( callback );
} else {
// Register the callback, but delay it in case `xhr.send` throws // Do send the request (this may raise an exception)
// Add to the list of active xhr callbacks xhr.send( options.hasContent && options.data || null );
xhr.onreadystatechange = xhrCallbacks[ id ] = callback; } catch ( e ) {
}
},
abort: function() { // #14683: Only rethrow if this hasn't been notified as an error yet
if ( callback ) { if ( callback ) {
callback( undefined, true ); throw e;
} }
} }
}; },
}
} );
}
// Functions to create xhrs abort: function() {
function createStandardXHR() { if ( callback ) {
try { callback();
return new window.XMLHttpRequest(); }
} catch ( e ) {} }
} };
}
function createActiveXHR() { } );
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch ( e ) {}
}
} ); } );
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,15 +3,11 @@ define( [ ...@@ -3,15 +3,11 @@ 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 nodeHook, boolHook, var 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 ) {
...@@ -45,7 +41,7 @@ jQuery.extend( { ...@@ -45,7 +41,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 : nodeHook ); ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
} }
if ( value !== undefined ) { if ( value !== undefined ) {
...@@ -78,9 +74,6 @@ jQuery.extend( { ...@@ -78,9 +74,6 @@ 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 ) {
...@@ -105,22 +98,10 @@ jQuery.extend( { ...@@ -105,22 +98,10 @@ 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
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { elem[ propName ] = false;
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( getSetAttribute ? name : propName ); elem.removeAttribute( name );
} }
} }
} }
...@@ -133,149 +114,29 @@ boolHook = { ...@@ -133,149 +114,29 @@ 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;
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { attrHandle[ name ] = function( elem, name, isXML ) {
attrHandle[ name ] = function( elem, name, isXML ) { var ret, handle;
var ret, handle; if ( !isXML ) {
if ( !isXML ) {
// Avoid an infinite loop by temporarily removing this function from the getter
// Avoid an infinite loop by temporarily removing this function from the getter handle = attrHandle[ name ];
handle = attrHandle[ name ]; attrHandle[ name ] = ret;
attrHandle[ name ] = ret; ret = getter( elem, name, isXML ) != null ?
ret = getter( elem, name, isXML ) != null ? name.toLowerCase() :
name.toLowerCase() : null;
null; attrHandle[ name ] = handle;
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 ) { ], function( jQuery, rnotwhite, dataPriv ) {
var rclass = /[\t\r\n\f]/g; var rclass = /[\t\r\n\f]/g;
function getClass( elem ) { function getClass( elem ) {
return jQuery.attr( elem, "class" ) || ""; return elem.getAttribute && elem.getAttribute( "class" ) || "";
} }
jQuery.fn.extend( { jQuery.fn.extend( {
...@@ -37,10 +38,10 @@ jQuery.fn.extend( { ...@@ -37,10 +38,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 ) {
jQuery.attr( elem, "class", finalValue ); elem.setAttribute( "class", finalValue );
} }
} }
} }
...@@ -86,7 +87,7 @@ jQuery.fn.extend( { ...@@ -86,7 +87,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 ) {
jQuery.attr( elem, "class", finalValue ); elem.setAttribute( "class", finalValue );
} }
} }
} }
...@@ -136,19 +137,21 @@ jQuery.fn.extend( { ...@@ -136,19 +137,21 @@ jQuery.fn.extend( {
className = getClass( this ); className = getClass( this );
if ( className ) { if ( className ) {
// store className if set // Store className if set
jQuery._data( this, "__className__", className ); dataPriv.set( 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.
jQuery.attr( this, "class", if ( this.setAttribute ) {
className || value === false ? this.setAttribute( "class",
"" : 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|object)$/i, var rfocusable = /^(?:input|select|textarea|button)$/i,
rclickable = /^(?:a|area)$/i; rclickable = /^(?:a|area)$/i;
jQuery.fn.extend( { jQuery.fn.extend( {
...@@ -14,14 +14,8 @@ jQuery.fn.extend( { ...@@ -14,14 +14,8 @@ 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 ) {}
} ); } );
} }
} ); } );
...@@ -85,21 +79,7 @@ jQuery.extend( { ...@@ -85,21 +79,7 @@ jQuery.extend( {
} }
} ); } );
// Some attributes require a special call on IE // Support: IE <=11 only
// 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 // Accessing the selectedIndex property
// forces the browser to respect setting selected // forces the browser to respect setting selected
// on the option // on the option
...@@ -109,14 +89,8 @@ if ( !support.optSelected ) { ...@@ -109,14 +89,8 @@ 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 ) {
if ( parent ) { parent.parentNode.selectedIndex;
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
} }
return null; return null;
}, },
...@@ -148,9 +122,4 @@ jQuery.each( [ ...@@ -148,9 +122,4 @@ 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,64 +4,30 @@ define( [ ...@@ -4,64 +4,30 @@ define( [
], function( document, support ) { ], function( document, support ) {
( function() { ( function() {
var a, var input = document.createElement( "input" ),
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" ) );
// Setup input.type = "checkbox";
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: Windows Web Apps (WWA) // Support: iOS<=5.1, Android<=4.2+
// `type` must use .setAttribute for WWA (#14901) // Default value for a checkbox should be "on"
input.setAttribute( "type", "checkbox" ); support.checkOn = input.value !== "";
div.appendChild( input );
a = div.getElementsByTagName( "a" )[ 0 ]; // Support: IE<=11+
// 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;
// Tests for enctype support on a form (#6743) // Support: Android<=2.3
support.enctype = !!document.createElement( "form" ).enctype; // Options inside disabled selects are incorrectly marked as disabled
// 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: IE8 only // Support: IE<=11+
// Check if we can trust getAttribute("value") // An input loses its value after becoming a radio
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.setAttribute( "type", "radio" ); input.type = "radio";
support.radioValue = input.value === "t"; support.radioValue = input.value === "t";
} )(); } )();
......
...@@ -17,8 +17,7 @@ jQuery.fn.extend( { ...@@ -17,8 +17,7 @@ jQuery.fn.extend( {
hooks = jQuery.valHooks[ elem.type ] || hooks = jQuery.valHooks[ elem.type ] ||
jQuery.valHooks[ elem.nodeName.toLowerCase() ]; jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( if ( hooks &&
hooks &&
"get" in hooks && "get" in hooks &&
( ret = hooks.get( elem, "value" ) ) !== undefined ( ret = hooks.get( elem, "value" ) ) !== undefined
) { ) {
...@@ -29,10 +28,10 @@ jQuery.fn.extend( { ...@@ -29,10 +28,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;
} }
...@@ -57,8 +56,10 @@ jQuery.fn.extend( { ...@@ -57,8 +56,10 @@ 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,6 +80,7 @@ jQuery.extend( { ...@@ -79,6 +80,7 @@ jQuery.extend( {
valHooks: { valHooks: {
option: { option: {
get: function( elem ) { get: function( elem ) {
var val = jQuery.find.attr( elem, "value" ); var val = jQuery.find.attr( elem, "value" );
return val != null ? return val != null ?
val : val :
...@@ -106,13 +108,12 @@ jQuery.extend( { ...@@ -106,13 +108,12 @@ jQuery.extend( {
for ( ; i < max; i++ ) { for ( ; i < max; i++ ) {
option = options[ i ]; option = options[ i ];
// oldIE doesn't update selected after form reset (#2551) // IE8-9 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.disabled : option.getAttribute( "disabled" ) === null ) &&
option.getAttribute( "disabled" ) === null ) &&
( !option.parentNode.disabled || ( !option.parentNode.disabled ||
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
...@@ -140,24 +141,10 @@ jQuery.extend( { ...@@ -140,24 +141,10 @@ jQuery.extend( {
while ( i-- ) { while ( i-- ) {
option = options[ i ]; option = options[ i ];
if ( option.selected =
if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) { jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
) {
// Support: IE6 optionSet = true;
// 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;
} }
} }
...@@ -165,8 +152,7 @@ jQuery.extend( { ...@@ -165,8 +152,7 @@ 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 = true; locked = queue = [];
if ( !memory ) { if ( !memory ) {
self.disable(); list = memory = "";
} }
return this; return this;
}, },
......
define( [ define( [
"./var/deletedIds", "./var/arr",
"./var/document", "./var/document",
"./var/slice", "./var/slice",
"./var/concat", "./var/concat",
...@@ -9,8 +9,7 @@ define( [ ...@@ -9,8 +9,7 @@ define( [
"./var/toString", "./var/toString",
"./var/hasOwn", "./var/hasOwn",
"./var/support" "./var/support"
], function( deletedIds, document, slice, concat, push, indexOf, ], function( arr, document, slice, concat, push, indexOf, class2type, toString, hasOwn, support ) {
class2type, toString, hasOwn, support ) {
var var
version = "@VERSION", version = "@VERSION",
...@@ -23,7 +22,7 @@ var ...@@ -23,7 +22,7 @@ var
return new jQuery.fn.init( selector, context ); return new jQuery.fn.init( selector, context );
}, },
// Support: Android<4.1, IE<9 // Support: Android<4.1
// 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,
...@@ -116,12 +115,12 @@ jQuery.fn = jQuery.prototype = { ...@@ -116,12 +115,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: deletedIds.sort, sort: arr.sort,
splice: deletedIds.splice splice: arr.splice
}; };
jQuery.extend = jQuery.fn.extend = function() { jQuery.extend = jQuery.fn.extend = function() {
var src, copyIsArray, copy, name, options, clone, var options, name, src, copy, copyIsArray, clone,
target = arguments[ 0 ] || {}, target = arguments[ 0 ] || {},
i = 1, i = 1,
length = arguments.length, length = arguments.length,
...@@ -131,7 +130,7 @@ jQuery.extend = jQuery.fn.extend = function() { ...@@ -131,7 +130,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++;
} }
...@@ -141,7 +140,7 @@ jQuery.extend = jQuery.fn.extend = function() { ...@@ -141,7 +140,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--;
...@@ -203,20 +202,14 @@ jQuery.extend( { ...@@ -203,20 +202,14 @@ 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 || function( obj ) { isArray: Array.isArray,
return jQuery.type( obj ) === "array";
},
isWindow: function( obj ) { isWindow: function( obj ) {
/* jshint eqeqeq: false */ return obj != null && obj === obj.window;
return obj != null && obj == obj.window;
}, },
isNumeric: function( obj ) { isNumeric: function( obj ) {
...@@ -229,77 +222,78 @@ jQuery.extend( { ...@@ -229,77 +222,78 @@ 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; var key;
// Must be an Object. // Not plain objects:
// Because of IE, we also have to check the presence of the constructor property. // - Any object or value whose internal [[Class]] property is not "[object Object]"
// Make sure that DOM nodes and window objects don't pass through, as well // - DOM nodes
if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { // - window
if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false; return false;
} }
try { // Not own constructor property must be Object
if ( obj.constructor &&
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call( 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;
} }
// Support: IE<9
// Handle iteration over inherited properties before own properties.
if ( !support.ownFirst ) {
for ( key in obj ) {
return hasOwn.call( obj, key );
}
}
// Own properties are enumerated firstly, so to speed up, // Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own. // if last one is own, then all properties are own
for ( key in obj ) {} for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key ); return key === undefined || hasOwn.call( obj, key );
}, },
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
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;
}, },
// Workarounds based on findings by Jim Driscoll // Evaluates a script in a global context
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( code ) {
globalEval: function( data ) { var script,
if ( data && jQuery.trim( data ) ) { indirect = eval;
// We use execScript on Internet Explorer code = jQuery.trim( code );
// We use an anonymous function so that context is window
// rather than jQuery in Firefox if ( code ) {
( window.execScript || function( data ) {
window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation // If the code includes a valid, prologue position
} )( data ); // strict mode pragma, execute code by injecting a
// 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 );
...@@ -330,7 +324,7 @@ jQuery.extend( { ...@@ -330,7 +324,7 @@ jQuery.extend( {
return obj; return obj;
}, },
// Support: Android<4.1, IE<9 // Support: Android<4.1
trim: function( text ) { trim: function( text ) {
return text == null ? return text == null ?
"" : "" :
...@@ -356,26 +350,7 @@ jQuery.extend( { ...@@ -356,26 +350,7 @@ jQuery.extend( {
}, },
inArray: function( elem, arr, i ) { inArray: function( elem, arr, i ) {
var len; return arr == null ? -1 : indexOf.call( arr, elem, i );
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 ) {
...@@ -383,16 +358,8 @@ jQuery.extend( { ...@@ -383,16 +358,8 @@ jQuery.extend( {
j = 0, j = 0,
i = first.length; i = first.length;
while ( j < len ) { for ( ; j < len; j++ ) {
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;
...@@ -457,7 +424,7 @@ jQuery.extend( { ...@@ -457,7 +424,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 args, proxy, tmp; var tmp, args, proxy;
if ( typeof context === "string" ) { if ( typeof context === "string" ) {
tmp = fn[ context ]; tmp = fn[ context ];
...@@ -483,9 +450,7 @@ jQuery.extend( { ...@@ -483,9 +450,7 @@ jQuery.extend( {
return proxy; return proxy;
}, },
now: function() { now: Date.now,
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.
...@@ -498,7 +463,7 @@ jQuery.extend( { ...@@ -498,7 +463,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 ] = deletedIds[ Symbol.iterator ]; jQuery.fn[ Symbol.iterator ] = arr[ 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,
length = elems.length, len = 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 < length; i++ ) { for ( ; i < len; i++ ) {
fn( fn(
elems[ i ], elems[ i ], key, raw ?
key, value :
raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) ) 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 ) :
length ? fn( elems[ 0 ], key ) : emptyGet; len ? 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;
} }
// init accepts an alternate rootjQuery // Method 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.charAt( 0 ) === "<" && if ( selector[ 0 ] === "<" &&
selector.charAt( selector.length - 1 ) === ">" && selector[ 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;
// scripts is true for back-compat // Option to run 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,17 +75,11 @@ var rootjQuery, ...@@ -75,17 +75,11 @@ var rootjQuery,
} else { } else {
elem = document.getElementById( match[ 2 ] ); elem = document.getElementById( match[ 2 ] );
// Check parentNode to catch when Blackberry 4.6 returns // Support: Blackberry 4.6
// nodes that are no longer in the document #6963 // gEBID returns nodes no longer in the document (#6963)
if ( elem && elem.parentNode ) { if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items // Inject the element directly into the jQuery object
// 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;
} }
...@@ -114,7 +108,7 @@ var rootjQuery, ...@@ -114,7 +108,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 typeof root.ready !== "undefined" ? return root.ready !== undefined ?
root.ready( selector ) : root.ready( selector ) :
// Execute immediately if ready is not present // Execute immediately if ready is not present
......
...@@ -5,7 +5,7 @@ define( [ ...@@ -5,7 +5,7 @@ define( [
"../manipulation/buildFragment" "../manipulation/buildFragment"
], function( jQuery, document, rsingleTag, buildFragment ) { ], function( jQuery, document, rsingleTag, buildFragment ) {
// data: string of html // 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
......
...@@ -61,33 +61,13 @@ jQuery.extend( { ...@@ -61,33 +61,13 @@ 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 );
// readyState === "complete" is good enough for us to call the dom ready in oldIE window.removeEventListener( "load", completed );
if ( document.addEventListener || jQuery.ready();
window.event.type === "load" ||
document.readyState === "complete" ) {
detach();
jQuery.ready();
}
} }
jQuery.ready.promise = function( obj ) { jQuery.ready.promise = function( obj ) {
...@@ -97,7 +77,7 @@ jQuery.ready.promise = function( obj ) { ...@@ -97,7 +77,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: IE6-10 // Support: IE9-10 only
// 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 ) ) {
...@@ -105,53 +85,13 @@ jQuery.ready.promise = function( obj ) { ...@@ -105,53 +85,13 @@ 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 );
// Standards-based browsers support DOMContentLoaded } else {
} 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 );
......
...@@ -8,32 +8,27 @@ define( [ ...@@ -8,32 +8,27 @@ define( [
"./css/var/rnumnonpx", "./css/var/rnumnonpx",
"./css/var/cssExpand", "./css/var/cssExpand",
"./css/var/isHidden", "./css/var/isHidden",
"./css/var/getStyles",
"./css/var/swap", "./css/var/swap",
"./css/curCSS", "./css/curCSS",
"./css/adjustCSS", "./css/adjustCSS",
"./css/defaultDisplay", "./css/defaultDisplay",
"./css/addGetHookIf", "./css/addGetHookIf",
"./css/support", "./css/support",
"./data/var/dataPriv",
"./core/init", "./core/init",
"./core/ready", "./core/ready",
"./selector" // contains "./selector" // contains
], function( jQuery, pnum, access, rmargin, document, rcssNum, rnumnonpx, cssExpand, ], function( jQuery, pnum, access, rmargin, document, rcssNum, rnumnonpx, cssExpand, isHidden,
isHidden, swap, curCSS, adjustCSS, defaultDisplay, addGetHookIf, support ) { getStyles, swap, curCSS, adjustCSS, defaultDisplay, addGetHookIf, support, dataPriv ) {
var var
// BuildExclude // Swappable if display is none or starts with table
getStyles = curCSS.getStyles, // except "table", "table-cell", or "table-caption"
ralpha = /alpha\([^)]*\)/i, // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
ropacity = /opacity\s*=\s*([^)]*)/i,
// swappable if display is none or starts with table except
// "table", "table-cell", or "table-caption"
// see here for display values:
// https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/, rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = { cssNormalTransform = {
...@@ -44,19 +39,16 @@ var ...@@ -44,19 +39,16 @@ var
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
emptyStyle = document.createElement( "div" ).style; emptyStyle = document.createElement( "div" ).style;
// BuildExclude // Return a css property mapped to a potentially vendor prefixed property
curCSS = curCSS.curCSS;
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName( name ) { function vendorPropName( name ) {
// shortcut for names that are not vendor prefixed // Shortcut for names that are not vendor prefixed
if ( name in emptyStyle ) { if ( name in emptyStyle ) {
return name; return name;
} }
// check for vendor prefixed names // Check for vendor prefixed names
var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ), var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
i = cssPrefixes.length; i = cssPrefixes.length;
while ( i-- ) { while ( i-- ) {
...@@ -67,69 +59,15 @@ function vendorPropName( name ) { ...@@ -67,69 +59,15 @@ function vendorPropName( name ) {
} }
} }
function showHide( elements, show ) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] =
jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) );
}
} else {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
jQuery._data(
elem,
"olddisplay",
hidden ? display : jQuery.css( elem, "display" )
);
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
function setPositiveNumber( elem, value, subtract ) { function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
// Any relative (+/-) values have already been
// normalized at this point
var matches = rcssNum.exec( value );
return matches ? return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks // Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
value; value;
} }
...@@ -146,7 +84,7 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { ...@@ -146,7 +84,7 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
for ( ; i < 4; i += 2 ) { for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it // Both box models exclude margin, so add it if we want it
if ( extra === "margin" ) { if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
} }
...@@ -158,16 +96,16 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { ...@@ -158,16 +96,16 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
} }
// at this point, extra isn't border nor margin, so remove border // At this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) { if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
} }
} else { } else {
// at this point, extra isn't content, so add padding // At this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// at this point, extra isn't content nor padding, so add border // At this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) { if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
} }
...@@ -183,8 +121,7 @@ function getWidthOrHeight( elem, name, extra ) { ...@@ -183,8 +121,7 @@ function getWidthOrHeight( elem, name, extra ) {
var valueIsBorderBox = true, var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight, val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ), styles = getStyles( elem ),
isBorderBox = support.boxSizing && isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// Support: IE11 only // Support: IE11 only
// In IE 11 fullscreen elements inside of an iframe have // In IE 11 fullscreen elements inside of an iframe have
...@@ -199,7 +136,7 @@ function getWidthOrHeight( elem, name, extra ) { ...@@ -199,7 +136,7 @@ function getWidthOrHeight( elem, name, extra ) {
} }
} }
// some non-html elements return undefined for offsetWidth, so check for null/undefined // Some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) { if ( val <= 0 || val == null ) {
...@@ -215,7 +152,7 @@ function getWidthOrHeight( elem, name, extra ) { ...@@ -215,7 +152,7 @@ function getWidthOrHeight( elem, name, extra ) {
return val; return val;
} }
// we need the check for style in case a browser which returns unreliable values // Check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style // for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && valueIsBorderBox = isBorderBox &&
( support.boxSizingReliable() || val === elem.style[ name ] ); ( support.boxSizingReliable() || val === elem.style[ name ] );
...@@ -224,7 +161,7 @@ function getWidthOrHeight( elem, name, extra ) { ...@@ -224,7 +161,7 @@ function getWidthOrHeight( elem, name, extra ) {
val = parseFloat( val ) || 0; val = parseFloat( val ) || 0;
} }
// use the active box-sizing model to add/subtract irrelevant styles // Use the active box-sizing model to add/subtract irrelevant styles
return ( val + return ( val +
augmentWidthOrHeight( augmentWidthOrHeight(
elem, elem,
...@@ -236,6 +173,66 @@ function getWidthOrHeight( elem, name, extra ) { ...@@ -236,6 +173,66 @@ function getWidthOrHeight( elem, name, extra ) {
) + "px"; ) + "px";
} }
function showHide( elements, show ) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = dataPriv.get( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = dataPriv.access(
elem,
"olddisplay",
defaultDisplay( elem.nodeName )
);
}
} else {
hidden = isHidden( elem );
if ( display !== "none" || !hidden ) {
dataPriv.set(
elem,
"olddisplay",
hidden ? display : jQuery.css( elem, "display" )
);
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
jQuery.extend( { jQuery.extend( {
// Add in style property hooks for overriding the default // Add in style property hooks for overriding the default
...@@ -273,9 +270,7 @@ jQuery.extend( { ...@@ -273,9 +270,7 @@ jQuery.extend( {
// Add in properties whose names you wish to fix before // Add in properties whose names you wish to fix before
// setting or getting the value // setting or getting the value
cssProps: { cssProps: {
"float": "cssFloat"
// normalize float css property
"float": support.cssFloat ? "cssFloat" : "styleFloat"
}, },
// Get and set the style property on a DOM Node // Get and set the style property on a DOM Node
...@@ -294,8 +289,7 @@ jQuery.extend( { ...@@ -294,8 +289,7 @@ jQuery.extend( {
name = jQuery.cssProps[ origName ] || name = jQuery.cssProps[ origName ] ||
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
// gets hook for the prefixed version // Gets hook for the prefixed version, then unprefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// Check if we're setting a value // Check if we're setting a value
...@@ -310,7 +304,7 @@ jQuery.extend( { ...@@ -310,7 +304,7 @@ jQuery.extend( {
type = "number"; type = "number";
} }
// Make sure that null and NaN values aren't set. See: #7116 // Make sure that null and NaN values aren't set (#7116)
if ( value == null || value !== value ) { if ( value == null || value !== value ) {
return; return;
} }
...@@ -320,9 +314,8 @@ jQuery.extend( { ...@@ -320,9 +314,8 @@ jQuery.extend( {
value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
} }
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks, // Support: IE9-11+
// but it would mean to define eight // background-* props affect original clone's values
// (for every problematic property) identical functions
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
style[ name ] = "inherit"; style[ name ] = "inherit";
} }
...@@ -331,11 +324,7 @@ jQuery.extend( { ...@@ -331,11 +324,7 @@ jQuery.extend( {
if ( !hooks || !( "set" in hooks ) || if ( !hooks || !( "set" in hooks ) ||
( value = hooks.set( elem, value, extra ) ) !== undefined ) { ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
// Support: IE style[ name ] = value;
// Swallow errors from 'invalid' CSS values (#5509)
try {
style[ name ] = value;
} catch ( e ) {}
} }
} else { } else {
...@@ -353,15 +342,14 @@ jQuery.extend( { ...@@ -353,15 +342,14 @@ jQuery.extend( {
}, },
css: function( elem, name, extra, styles ) { css: function( elem, name, extra, styles ) {
var num, val, hooks, var val, num, hooks,
origName = jQuery.camelCase( name ); origName = jQuery.camelCase( name );
// Make sure that we're working with the right name // Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] || name = jQuery.cssProps[ origName ] ||
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
// gets hook for the prefixed version // Try prefixed name followed by the unprefixed name
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there // If a hook was provided get the computed value from there
...@@ -374,12 +362,12 @@ jQuery.extend( { ...@@ -374,12 +362,12 @@ jQuery.extend( {
val = curCSS( elem, name, styles ); val = curCSS( elem, name, styles );
} }
//convert "normal" to computed value // Convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) { if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ]; val = cssNormalTransform[ name ];
} }
// Return, converting to number if forced or a qualifier was provided and val looks numeric // Make numeric if forced or a qualifier was provided and val looks numeric
if ( extra === "" || extra ) { if ( extra === "" || extra ) {
num = parseFloat( val ); num = parseFloat( val );
return extra === true || isFinite( num ) ? num || 0 : val; return extra === true || isFinite( num ) ? num || 0 : val;
...@@ -393,8 +381,8 @@ jQuery.each( [ "height", "width" ], function( i, name ) { ...@@ -393,8 +381,8 @@ jQuery.each( [ "height", "width" ], function( i, name ) {
get: function( elem, computed, extra ) { get: function( elem, computed, extra ) {
if ( computed ) { if ( computed ) {
// certain elements can have dimension info if we invisibly show them // Certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this // but it must have a current display style that would benefit
return rdisplayswap.test( jQuery.css( elem, "display" ) ) && return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
elem.offsetWidth === 0 ? elem.offsetWidth === 0 ?
swap( elem, cssShow, function() { swap( elem, cssShow, function() {
...@@ -405,97 +393,48 @@ jQuery.each( [ "height", "width" ], function( i, name ) { ...@@ -405,97 +393,48 @@ jQuery.each( [ "height", "width" ], function( i, name ) {
}, },
set: function( elem, value, extra ) { set: function( elem, value, extra ) {
var styles = extra && getStyles( elem ); var matches,
return setPositiveNumber( elem, value, extra ? styles = extra && getStyles( elem ),
augmentWidthOrHeight( subtract = extra && augmentWidthOrHeight(
elem, elem,
name, name,
extra, extra,
support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles styles
) : 0 );
);
}
};
} );
if ( !support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity // Convert to pixels if value adjustment is needed
return ropacity.test( ( computed && elem.currentStyle ? if ( subtract && ( matches = rcssNum.exec( value ) ) &&
elem.currentStyle.filter : ( matches[ 3 ] || "px" ) !== "px" ) {
elem.style.filter ) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) { elem.style[ name ] = value;
var style = elem.style, value = jQuery.css( elem, name );
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist -
// attempt to remove filter attribute #6652
// if value === "", then remove inline opacity #12685
if ( ( value >= 1 || value === "" ) &&
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
style.removeAttribute ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there is no filter style applied in a css rule
// or unset inline opacity, we are done
if ( value === "" || currentStyle && !currentStyle.filter ) {
return;
}
} }
// otherwise, set new filter values return setPositiveNumber( elem, value, subtract );
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
} }
}; };
} } );
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
function( elem, computed ) { function( elem, computed ) {
if ( computed ) { if ( computed ) {
return swap( elem, { "display": "inline-block" }, return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
curCSS, [ elem, "marginRight" ] ); elem.getBoundingClientRect().left -
swap( elem, { marginLeft: 0 }, function() {
return elem.getBoundingClientRect().left;
} )
) + "px";
} }
} }
); );
jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, // Support: Android 2.3
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
function( elem, computed ) { function( elem, computed ) {
if ( computed ) { if ( computed ) {
return ( return swap( elem, { "display": "inline-block" },
parseFloat( curCSS( elem, "marginLeft" ) ) || curCSS, [ elem, "marginRight" ] );
// Support: IE<=11+
// Running getBoundingClientRect on a disconnected node in IE throws an error
// Support: IE8 only
// getClientRects() errors on disconnected elems
( jQuery.contains( elem.ownerDocument, elem ) ?
elem.getBoundingClientRect().left -
swap( elem, { marginLeft: 0 }, function() {
return elem.getBoundingClientRect().left;
} ) :
0
)
) + "px";
} }
} }
); );
...@@ -511,7 +450,7 @@ jQuery.each( { ...@@ -511,7 +450,7 @@ jQuery.each( {
var i = 0, var i = 0,
expanded = {}, expanded = {},
// assumes a single number if not a string // Assumes a single number if not a string
parts = typeof value === "string" ? value.split( " " ) : [ value ]; parts = typeof value === "string" ? value.split( " " ) : [ value ];
for ( ; i < 4; i++ ) { for ( ; i < 4; i++ ) {
......
define( [ define( [
"exports",
"../core", "../core",
"../var/documentElement",
"./var/rnumnonpx", "./var/rnumnonpx",
"./var/rmargin", "./var/rmargin",
"./var/getStyles",
"./support", "./support",
"../selector" // contains "../selector" // Get jQuery.contains
], function( exports, jQuery, documentElement, rnumnonpx, rmargin, support ) { ], function( jQuery, rnumnonpx, rmargin, getStyles, support ) {
var getStyles, curCSS, function curCSS( elem, name, computed ) {
rposition = /^(top|right|bottom|left)$/; var width, minWidth, maxWidth, ret,
style = elem.style;
if ( window.getComputedStyle ) {
getStyles = function( elem ) { computed = computed || getStyles( elem );
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined;
// Support: IE<=11+, Firefox<=30+ (#15098, #14150)
// IE throws on elements created in popups // Support: Opera 12.1x only
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle" // Fall back to style even without computed
var view = elem.ownerDocument.defaultView; // computed is undefined for elems on document fragments
if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) {
if ( !view || !view.opener ) { ret = jQuery.style( elem, name );
view = window; }
}
// Support: IE9
return view.getComputedStyle( elem ); // getPropertyValue is only needed for .css('filter') (#12537)
}; if ( computed ) {
curCSS = function( elem, name, computed ) { // A tribute to the "awesome hack by Dean Edwards"
var width, minWidth, maxWidth, ret, // Android Browser returns percentage for some values,
style = elem.style; // but width seems to be reliably pixels.
// This is against the CSSOM draft spec:
computed = computed || getStyles( elem ); // http://dev.w3.org/csswg/cssom/#resolved-values
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
left = style.left; width = style.width;
rs = elem.runtimeStyle; minWidth = style.minWidth;
rsLeft = rs && rs.left; maxWidth = style.maxWidth;
// Put in the new values to get a computed value out // Put in the new values to get a computed value out
if ( rsLeft ) { style.minWidth = style.maxWidth = style.width = ret;
rs.left = elem.currentStyle.left; ret = computed.width;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values // Revert the changed values
style.left = left; style.width = width;
if ( rsLeft ) { style.minWidth = minWidth;
rs.left = rsLeft; style.maxWidth = maxWidth;
}
} }
}
return ret !== undefined ?
// Support: IE // Support: IE9-11+
// IE returns zIndex value as an integer. // IE returns zIndex value as an integer.
return ret === undefined ? ret + "" :
ret : ret;
ret + "" || "auto";
};
} }
exports.getStyles = getStyles; return curCSS;
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 ].contentWindow || iframe[ 0 ].contentDocument ).document; doc = iframe[ 0 ].contentDocument;
// Support: IE // Support: IE
doc.write(); doc.write();
......
define( [ define( [
"../core", "../core",
"./support", "../selector"
"../selector", ], function( jQuery ) {
"../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
return support.reliableHiddenOffsets() ? // Use OR instead of AND as the element is not visible if either is true
( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 && // See tickets #10406 and #13132
!elem.getClientRects().length ) : return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0;
filterHidden( elem );
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
}; };
} ); } );
define( [], function() { define( [
"../data/var/dataPriv"
], function( dataPriv ) {
function showHide( elements, show ) { function showHide( elements, show ) {
var display, elem, var display, elem,
values = [], values = [],
...@@ -17,14 +20,14 @@ function showHide( elements, show ) { ...@@ -17,14 +20,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 ] = jQuery._data( elem, "display" ) || ""; values[ index ] = dataPriv.get( 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
jQuery._data( elem, "display", display ); dataPriv.set( elem, "display", display );
} }
} }
} }
......
...@@ -6,8 +6,7 @@ define( [ ...@@ -6,8 +6,7 @@ define( [
], function( jQuery, document, documentElement, support ) { ], function( jQuery, document, documentElement, support ) {
( function() { ( function() {
var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal, var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal,
container = document.createElement( "div" ), container = document.createElement( "div" ),
div = document.createElement( "div" ); div = document.createElement( "div" );
...@@ -16,166 +15,105 @@ define( [ ...@@ -16,166 +15,105 @@ define( [
return; return;
} }
div.style.cssText = "float:left;opacity:.5"; // Support: IE9-11+
// Style of cloned element affects source element cloned (#8908)
// Support: IE<9
// Make sure that element opacity exists (as opposed to filter)
support.opacity = div.style.opacity === "0.5";
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
support.cssFloat = !!div.style.cssFloat;
div.style.backgroundClip = "content-box"; div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = ""; div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box"; support.clearCloneStyle = div.style.backgroundClip === "content-box";
container = document.createElement( "div" );
container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
"padding:0;margin-top:1px;position:absolute"; "padding:0;margin-top:1px;position:absolute";
div.innerHTML = "";
container.appendChild( div ); container.appendChild( div );
// Support: Firefox<29, Android 2.3 // Executing both pixelPosition & boxSizingReliable tests require only one layout
// Vendor-prefix box-sizing // so they're executed at the same time to save the second computation.
support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" || function computeStyleTests() {
div.style.WebkitBoxSizing === ""; div.style.cssText =
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" +
"position:relative;display:block;" +
"margin:auto;border:1px;padding:1px;" +
"top:1%;width:50%";
div.innerHTML = "";
documentElement.appendChild( container );
var divStyle = window.getComputedStyle( div );
pixelPositionVal = divStyle.top !== "1%";
reliableMarginLeftVal = divStyle.marginLeft === "2px";
boxSizingReliableVal = divStyle.width === "4px";
// Support: Android 4.0 - 4.3 only
// Some styles come back with percentage values, even though they shouldn't
div.style.marginRight = "50%";
pixelMarginRightVal = divStyle.marginRight === "4px";
documentElement.removeChild( container );
}
jQuery.extend( support, { jQuery.extend( support, {
reliableHiddenOffsets: function() { pixelPosition: function() {
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableHiddenOffsetsVal;
},
// This test is executed only once but we still do memoizing
// since we can use the boxSizingReliable pre-computing.
// No need to check if the test was already performed, though.
computeStyleTests();
return pixelPositionVal;
},
boxSizingReliable: function() { boxSizingReliable: function() {
if ( boxSizingReliableVal == null ) {
// We're checking for pixelPositionVal here instead of boxSizingReliableVal
// since that compresses better and they're computed together anyway.
if ( pixelPositionVal == null ) {
computeStyleTests(); computeStyleTests();
} }
return boxSizingReliableVal; return boxSizingReliableVal;
}, },
pixelMarginRight: function() { pixelMarginRight: function() {
// Support: Android 4.0-4.3 // Support: Android 4.0-4.3
if ( pixelPositionVal == null ) { // We're checking for boxSizingReliableVal here instead of pixelMarginRightVal
// since that compresses better and they're computed together anyway.
if ( boxSizingReliableVal == null ) {
computeStyleTests(); computeStyleTests();
} }
return pixelMarginRightVal; return pixelMarginRightVal;
}, },
pixelPosition: function() {
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return pixelPositionVal;
},
reliableMarginRight: function() {
// Support: Android 2.3
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableMarginRightVal;
},
reliableMarginLeft: function() { reliableMarginLeft: function() {
// Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37 // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
if ( pixelPositionVal == null ) { if ( boxSizingReliableVal == null ) {
computeStyleTests(); computeStyleTests();
} }
return reliableMarginLeftVal; return reliableMarginLeftVal;
} },
} ); reliableMarginRight: function() {
function computeStyleTests() {
var contents, divStyle,
documentElement = document.documentElement;
// Setup
documentElement.appendChild( container );
div.style.cssText =
// Support: Android 2.3 // Support: Android 2.3
// Vendor-prefix box-sizing // Check if div with explicit width and no margin-right incorrectly
"-webkit-box-sizing:border-box;box-sizing:border-box;" + // gets computed margin-right based on width of container. (#3333)
"position:relative;display:block;" +
"margin:auto;border:1px;padding:1px;" +
"top:1%;width:50%";
// Support: IE<9
// Assume reasonable values in the absence of getComputedStyle
pixelPositionVal = boxSizingReliableVal = reliableMarginLeftVal = false;
pixelMarginRightVal = reliableMarginRightVal = true;
// Check for getComputedStyle so that this code is not run in IE<9.
if ( window.getComputedStyle ) {
divStyle = window.getComputedStyle( div );
pixelPositionVal = ( divStyle || {} ).top !== "1%";
reliableMarginLeftVal = ( divStyle || {} ).marginLeft === "2px";
boxSizingReliableVal = ( divStyle || { width: "4px" } ).width === "4px";
// Support: Android 4.0 - 4.3 only
// Some styles come back with percentage values, even though they shouldn't
div.style.marginRight = "50%";
pixelMarginRightVal = ( divStyle || { marginRight: "4px" } ).marginRight === "4px";
// Support: Android 2.3 only
// Div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container (#3333)
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
contents = div.appendChild( document.createElement( "div" ) ); // This support function is only executed once so no memoizing is needed.
var ret,
marginDiv = div.appendChild( document.createElement( "div" ) );
// Reset CSS: box-sizing; display; margin; border; padding // Reset CSS: box-sizing; display; margin; border; padding
contents.style.cssText = div.style.cssText = marginDiv.style.cssText = div.style.cssText =
// Support: Android 2.3 // Support: Android 2.3
// Vendor-prefix box-sizing // Vendor-prefix box-sizing
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + "-webkit-box-sizing:content-box;box-sizing:content-box;" +
"box-sizing:content-box;display:block;margin:0;border:0;padding:0"; "display:block;margin:0;border:0;padding:0";
contents.style.marginRight = contents.style.width = "0"; marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px"; div.style.width = "1px";
documentElement.appendChild( container );
reliableMarginRightVal = ret = !parseFloat( window.getComputedStyle( marginDiv ).marginRight );
!parseFloat( ( window.getComputedStyle( contents ) || {} ).marginRight );
div.removeChild( contents ); documentElement.removeChild( container );
} div.removeChild( marginDiv );
// Support: IE6-8 return ret;
// First check that getClientRects works as expected
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
div.style.display = "none";
reliableHiddenOffsetsVal = div.getClientRects().length === 0;
if ( reliableHiddenOffsetsVal ) {
div.style.display = "";
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
contents = div.getElementsByTagName( "td" );
contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
if ( reliableHiddenOffsetsVal ) {
contents[ 0 ].style.display = "";
contents[ 1 ].style.display = "none";
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
}
} }
} );
// Teardown
documentElement.removeChild( container );
}
} )(); } )();
return support; return support;
......
define( [ define( [
"./core", "./core",
"./var/deletedIds", "./core/access",
"./data/support", "./data/var/dataPriv",
"./data/var/acceptData" "./data/var/dataUser"
], function( jQuery, deletedIds, support, acceptData ) { ], function( jQuery, access, dataPriv, dataUser ) {
// Implementation Summary
//
// 1. Enforce API surface and semantic compatibility with 1.9.x branch
// 2. Improve the module's maintainability by reducing the storage
// paths to a single mechanism.
// 3. Use the same single mechanism to support "private" and "user" data.
// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
// 5. Avoid exposing implementation details on user objects (eg. expando properties)
// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
rmultiDash = /([A-Z])/g; rmultiDash = /[A-Z]/g;
function dataAttr( elem, key, data ) { function dataAttr( elem, key, data ) {
var name;
// If nothing was found internally, try to fetch any // If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute // data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) { if ( data === undefined && elem.nodeType === 1 ) {
name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name ); data = elem.getAttribute( name );
if ( typeof data === "string" ) { if ( typeof data === "string" ) {
...@@ -31,249 +40,35 @@ function dataAttr( elem, key, data ) { ...@@ -31,249 +40,35 @@ function dataAttr( elem, key, data ) {
} catch ( e ) {} } catch ( e ) {}
// Make sure we set the data so it isn't changed later // Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data ); dataUser.set( elem, key, data );
} else { } else {
data = undefined; data = undefined;
} }
} }
return data; return data;
} }
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !acceptData( elem ) ) {
return;
}
var ret, thisCache,
internalKey = jQuery.expando,
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) &&
data === undefined && typeof name === "string" ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
// Avoid exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( typeof name === "string" ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
}
function internalRemoveData( elem, name, pvt ) {
if ( !acceptData( elem ) ) {
return;
}
var thisCache, i,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split( " " );
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
i = name.length;
while ( i-- ) {
delete thisCache[ name[ i ] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( pvt ? !isEmptyDataObject( thisCache ) : !jQuery.isEmptyObject( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
/* jshint eqeqeq: false */
} else if ( support.deleteExpando || cache != cache.window ) {
/* jshint eqeqeq: true */
delete cache[ id ];
// When all else fails, undefined
} else {
cache[ id ] = undefined;
}
}
jQuery.extend( { jQuery.extend( {
cache: {},
// The following elements (space-suffixed to avoid Object.prototype collisions)
// throw uncatchable exceptions if you attempt to set expando properties
noData: {
"applet ": true,
"embed ": true,
// ...but Flash objects (which have this classid) *can* handle expandos
"object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
},
hasData: function( elem ) { hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ]; return dataUser.hasData( elem ) || dataPriv.hasData( elem );
return !!elem && !isEmptyDataObject( elem );
}, },
data: function( elem, name, data ) { data: function( elem, name, data ) {
return internalData( elem, name, data ); return dataUser.access( elem, name, data );
}, },
removeData: function( elem, name ) { removeData: function( elem, name ) {
return internalRemoveData( elem, name ); dataUser.remove( elem, name );
}, },
// For internal use only. // TODO: Now that all calls to _data and _removeData have been replaced
// with direct calls to dataPriv methods, these can be deprecated.
_data: function( elem, name, data ) { _data: function( elem, name, data ) {
return internalData( elem, name, data, true ); return dataPriv.access( elem, name, data );
}, },
_removeData: function( elem, name ) { _removeData: function( elem, name ) {
return internalRemoveData( elem, name, true ); dataPriv.remove( elem, name );
} }
} ); } );
...@@ -283,15 +78,12 @@ jQuery.fn.extend( { ...@@ -283,15 +78,12 @@ jQuery.fn.extend( {
elem = this[ 0 ], elem = this[ 0 ],
attrs = elem && elem.attributes; attrs = elem && elem.attributes;
// Special expections of .data basically thwart jQuery.access,
// so implement the relevant behavior ourselves
// Gets all values // Gets all values
if ( key === undefined ) { if ( key === undefined ) {
if ( this.length ) { if ( this.length ) {
data = jQuery.data( elem ); data = dataUser.get( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
i = attrs.length; i = attrs.length;
while ( i-- ) { while ( i-- ) {
...@@ -305,7 +97,7 @@ jQuery.fn.extend( { ...@@ -305,7 +97,7 @@ jQuery.fn.extend( {
} }
} }
} }
jQuery._data( elem, "parsedAttrs", true ); dataPriv.set( elem, "hasDataAttrs", true );
} }
} }
...@@ -315,25 +107,78 @@ jQuery.fn.extend( { ...@@ -315,25 +107,78 @@ jQuery.fn.extend( {
// Sets multiple values // Sets multiple values
if ( typeof key === "object" ) { if ( typeof key === "object" ) {
return this.each( function() { return this.each( function() {
jQuery.data( this, key ); dataUser.set( this, key );
} ); } );
} }
return arguments.length > 1 ? return access( this, function( value ) {
var data, camelKey;
// The calling jQuery object (element matches) is not empty
// (and therefore has an element appears at this[ 0 ]) and the
// `value` parameter was not undefined. An empty jQuery object
// will result in `undefined` for elem = this[ 0 ] which will
// throw an exception if an attempt to read a data cache is made.
if ( elem && value === undefined ) {
// Attempt to get data from the cache
// with the key as-is
data = dataUser.get( elem, key ) ||
// Try to find dashed key if it exists (gh-2779)
// This is for 2.2.x only
dataUser.get( elem, key.replace( rmultiDash, "-$&" ).toLowerCase() );
if ( data !== undefined ) {
return data;
}
// Sets one value camelKey = jQuery.camelCase( key );
// Attempt to get data from the cache
// with the key camelized
data = dataUser.get( elem, camelKey );
if ( data !== undefined ) {
return data;
}
// Attempt to "discover" the data in
// HTML5 custom data-* attrs
data = dataAttr( elem, camelKey, undefined );
if ( data !== undefined ) {
return data;
}
// We tried really hard, but the data doesn't exist.
return;
}
// Set the data...
camelKey = jQuery.camelCase( key );
this.each( function() { this.each( function() {
jQuery.data( this, key, value );
} ) :
// Gets one value // First, attempt to store a copy or reference of any
// Try to fetch any internally stored data first // data that might've been store with a camelCased key.
elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; var data = dataUser.get( this, camelKey );
// For HTML5 data-* attribute interop, we have to
// store property names with dashes in a camelCase form.
// This might not apply to all properties...*
dataUser.set( this, camelKey, value );
// *... In the case of properties that might _actually_
// have dashes, we need to also store a copy of that
// unchanged property.
if ( key.indexOf( "-" ) > -1 && data !== undefined ) {
dataUser.set( this, key, value );
}
} );
}, null, value, arguments.length > 1, null, true );
}, },
removeData: function( key ) { removeData: function( key ) {
return this.each( function() { return this.each( function() {
jQuery.removeData( this, key ); dataUser.remove( this, key );
} ); } );
} }
} ); } );
......
define( [ define( function() {
"../../core"
], function( jQuery ) {
/** /**
* Determines whether an object can have data * Determines whether an object can have data
*/ */
return function( elem ) { return function( owner ) {
var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ],
nodeType = +elem.nodeType || 1;
// Do not set data on non-element DOM nodes because it will not be cleared (#8335). // Accepts only:
return nodeType !== 1 && nodeType !== 9 ? // - Node
false : // - Node.ELEMENT_NODE
// - Node.DOCUMENT_NODE
// Nodes accept data unless otherwise specified; rejection can be conditional // - Object
!noData || noData !== true && elem.getAttribute( "classid" ) === noData; // - Any
/* jshint -W018 */
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
}; };
} ); } );
...@@ -120,7 +120,6 @@ jQuery.extend( { ...@@ -120,7 +120,6 @@ 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 );
} }
...@@ -129,7 +128,7 @@ jQuery.extend( { ...@@ -129,7 +128,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 );
...@@ -146,7 +145,7 @@ jQuery.extend( { ...@@ -146,7 +145,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 );
} }
......
define( [ define( [
"./core", "./core"
"./traversing"
], function( jQuery ) { ], function( jQuery ) {
jQuery.fn.extend( { jQuery.fn.extend( {
...@@ -21,14 +20,13 @@ jQuery.fn.extend( { ...@@ -21,14 +20,13 @@ jQuery.fn.extend( {
return arguments.length === 1 ? return arguments.length === 1 ?
this.off( selector, "**" ) : this.off( selector, "**" ) :
this.off( types, selector || "**", fn ); this.off( types, selector || "**", fn );
},
size: function() {
return this.length;
} }
} ); } );
// The number of elements contained in the matched element set
jQuery.fn.size = function() {
return this.length;
};
jQuery.fn.andSelf = jQuery.fn.addBack; jQuery.fn.andSelf = jQuery.fn.addBack;
} ); } );
...@@ -7,9 +7,9 @@ define( [ ...@@ -7,9 +7,9 @@ define( [
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
function( defaultExtra, funcName ) { function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth // Margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) { jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
...@@ -31,8 +31,6 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { ...@@ -31,8 +31,6 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
// whichever is greatest // whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only,
// but there is currently no good, small way to fix it.
return Math.max( return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ], elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ], elem.body[ "offset" + name ], doc[ "offset" + name ],
......
define( [ define( [
"./core", "./core",
"./effects/support", "./var/document",
"./var/rcssNum", "./var/rcssNum",
"./var/rnotwhite",
"./css/var/cssExpand", "./css/var/cssExpand",
"./var/rnotwhite",
"./css/var/isHidden", "./css/var/isHidden",
"./css/adjustCSS", "./css/adjustCSS",
"./css/defaultDisplay", "./css/defaultDisplay",
"./data/var/dataPriv",
"./var/document",
"./core/init", "./core/init",
"./effects/Tween", "./effects/Tween",
"./queue", "./queue",
"./css", "./css",
"./deferred", "./deferred",
"./traversing" "./traversing"
], function( jQuery, support, rcssNum, rnotwhite, ], function( jQuery, document, rcssNum, cssExpand, rnotwhite,
cssExpand, isHidden, adjustCSS, defaultDisplay ) { isHidden, adjustCSS, defaultDisplay, dataPriv ) {
var var
fxNow, timerId, fxNow, timerId,
...@@ -34,11 +34,11 @@ function createFxNow() { ...@@ -34,11 +34,11 @@ function createFxNow() {
// Generate parameters to create a standard animation // Generate parameters to create a standard animation
function genFx( type, includeWidth ) { function genFx( type, includeWidth ) {
var which, var which,
attrs = { height: type }, i = 0,
i = 0; attrs = { height: type };
// if we include width, step value is 1 to do all cssExpand values, // If we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right // otherwise step value is 2 to skip over Left and Right
includeWidth = includeWidth ? 1 : 0; includeWidth = includeWidth ? 1 : 0;
for ( ; i < 4 ; i += 2 - includeWidth ) { for ( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ]; which = cssExpand[ i ];
...@@ -60,7 +60,7 @@ function createTween( value, prop, animation ) { ...@@ -60,7 +60,7 @@ function createTween( value, prop, animation ) {
for ( ; index < length; index++ ) { for ( ; index < length; index++ ) {
if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
// we're done with this property // We're done with this property
return tween; return tween;
} }
} }
...@@ -73,9 +73,9 @@ function defaultPrefilter( elem, props, opts ) { ...@@ -73,9 +73,9 @@ function defaultPrefilter( elem, props, opts ) {
orig = {}, orig = {},
style = elem.style, style = elem.style,
hidden = elem.nodeType && isHidden( elem ), hidden = elem.nodeType && isHidden( elem ),
dataShow = jQuery._data( elem, "fxshow" ); dataShow = dataPriv.get( elem, "fxshow" );
// handle queue: false promises // Handle queue: false promises
if ( !opts.queue ) { if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" ); hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) { if ( hooks.unqueued == null ) {
...@@ -91,8 +91,7 @@ function defaultPrefilter( elem, props, opts ) { ...@@ -91,8 +91,7 @@ function defaultPrefilter( elem, props, opts ) {
anim.always( function() { anim.always( function() {
// doing this makes sure that the complete handler will be called // Ensure the complete handler is called before this completes
// before this completes
anim.always( function() { anim.always( function() {
hooks.unqueued--; hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) { if ( !jQuery.queue( elem, "fx" ).length ) {
...@@ -102,11 +101,11 @@ function defaultPrefilter( elem, props, opts ) { ...@@ -102,11 +101,11 @@ function defaultPrefilter( elem, props, opts ) {
} ); } );
} }
// height/width overflow pass // Height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// Make sure that nothing sneaks out // Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not // Record all 3 overflow attributes because IE9-10 do not
// change the overflow attribute when overflowX and // change the overflow attribute when overflowX and
// overflowY are set to the same value // overflowY are set to the same value
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
...@@ -117,29 +116,20 @@ function defaultPrefilter( elem, props, opts ) { ...@@ -117,29 +116,20 @@ function defaultPrefilter( elem, props, opts ) {
// Test default display if display is currently "none" // Test default display if display is currently "none"
checkDisplay = display === "none" ? checkDisplay = display === "none" ?
jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; dataPriv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
style.display = "inline-block";
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
} }
} }
if ( opts.overflow ) { if ( opts.overflow ) {
style.overflow = "hidden"; style.overflow = "hidden";
if ( !support.shrinkWrapBlocks() ) { anim.always( function() {
anim.always( function() { style.overflow = opts.overflow[ 0 ];
style.overflow = opts.overflow[ 0 ]; style.overflowX = opts.overflow[ 1 ];
style.overflowX = opts.overflow[ 1 ]; style.overflowY = opts.overflow[ 2 ];
style.overflowY = opts.overflow[ 2 ]; } );
} );
}
} }
// show/hide pass // show/hide pass
...@@ -172,10 +162,10 @@ function defaultPrefilter( elem, props, opts ) { ...@@ -172,10 +162,10 @@ function defaultPrefilter( elem, props, opts ) {
hidden = dataShow.hidden; hidden = dataShow.hidden;
} }
} else { } else {
dataShow = jQuery._data( elem, "fxshow", {} ); dataShow = dataPriv.access( elem, "fxshow", {} );
} }
// store state if its toggle - enables .stop().toggle() to "reverse" // Store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) { if ( toggle ) {
dataShow.hidden = !hidden; dataShow.hidden = !hidden;
} }
...@@ -188,7 +178,8 @@ function defaultPrefilter( elem, props, opts ) { ...@@ -188,7 +178,8 @@ function defaultPrefilter( elem, props, opts ) {
} }
anim.done( function() { anim.done( function() {
var prop; var prop;
jQuery._removeData( elem, "fxshow" );
dataPriv.remove( elem, "fxshow" );
for ( prop in orig ) { for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] ); jQuery.style( elem, prop, orig[ prop ] );
} }
...@@ -234,8 +225,8 @@ function propFilter( props, specialEasing ) { ...@@ -234,8 +225,8 @@ function propFilter( props, specialEasing ) {
value = hooks.expand( value ); value = hooks.expand( value );
delete props[ name ]; delete props[ name ];
// not quite $.extend, this wont overwrite keys already present. // Not quite $.extend, this won't overwrite existing keys.
// also - reusing 'index' from above because we have the correct "name" // Reusing 'index' because we have the correct "name"
for ( index in value ) { for ( index in value ) {
if ( !( index in props ) ) { if ( !( index in props ) ) {
props[ index ] = value[ index ]; props[ index ] = value[ index ];
...@@ -255,7 +246,7 @@ function Animation( elem, properties, options ) { ...@@ -255,7 +246,7 @@ function Animation( elem, properties, options ) {
length = Animation.prefilters.length, length = Animation.prefilters.length,
deferred = jQuery.Deferred().always( function() { deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector // Don't match elem in the :animated selector
delete tick.elem; delete tick.elem;
} ), } ),
tick = function() { tick = function() {
...@@ -306,7 +297,7 @@ function Animation( elem, properties, options ) { ...@@ -306,7 +297,7 @@ function Animation( elem, properties, options ) {
stop: function( gotoEnd ) { stop: function( gotoEnd ) {
var index = 0, var index = 0,
// if we are going to the end, we want to run all the tweens // If we are going to the end, we want to run all the tweens
// otherwise we skip this part // otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0; length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) { if ( stopped ) {
...@@ -317,8 +308,7 @@ function Animation( elem, properties, options ) { ...@@ -317,8 +308,7 @@ function Animation( elem, properties, options ) {
animation.tweens[ index ].run( 1 ); animation.tweens[ index ].run( 1 );
} }
// resolve when we played the last frame // Resolve when we played the last frame; otherwise, reject
// otherwise, reject
if ( gotoEnd ) { if ( gotoEnd ) {
deferred.notifyWith( elem, [ animation, 1, 0 ] ); deferred.notifyWith( elem, [ animation, 1, 0 ] );
deferred.resolveWith( elem, [ animation, gotoEnd ] ); deferred.resolveWith( elem, [ animation, gotoEnd ] );
...@@ -365,7 +355,6 @@ function Animation( elem, properties, options ) { ...@@ -365,7 +355,6 @@ function Animation( elem, properties, options ) {
} }
jQuery.Animation = jQuery.extend( Animation, { jQuery.Animation = jQuery.extend( Animation, {
tweeners: { tweeners: {
"*": [ function( prop, value ) { "*": [ function( prop, value ) {
var tween = this.createTween( prop, value ); var tween = this.createTween( prop, value );
...@@ -412,11 +401,11 @@ jQuery.speed = function( speed, easing, fn ) { ...@@ -412,11 +401,11 @@ jQuery.speed = function( speed, easing, fn ) {
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
}; };
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ?
opt.duration in jQuery.fx.speeds ? opt.duration : opt.duration in jQuery.fx.speeds ?
jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx" // Normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) { if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx"; opt.queue = "fx";
} }
...@@ -440,10 +429,10 @@ jQuery.speed = function( speed, easing, fn ) { ...@@ -440,10 +429,10 @@ jQuery.speed = function( speed, easing, fn ) {
jQuery.fn.extend( { jQuery.fn.extend( {
fadeTo: function( speed, to, easing, callback ) { fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0 // Show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show() return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified // Animate to the value specified
.end().animate( { opacity: to }, speed, easing, callback ); .end().animate( { opacity: to }, speed, easing, callback );
}, },
animate: function( prop, speed, easing, callback ) { animate: function( prop, speed, easing, callback ) {
...@@ -455,7 +444,7 @@ jQuery.fn.extend( { ...@@ -455,7 +444,7 @@ jQuery.fn.extend( {
var anim = Animation( this, jQuery.extend( {}, prop ), optall ); var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations, or finishing resolves immediately // Empty animations, or finishing resolves immediately
if ( empty || jQuery._data( this, "finish" ) ) { if ( empty || dataPriv.get( this, "finish" ) ) {
anim.stop( true ); anim.stop( true );
} }
}; };
...@@ -485,7 +474,7 @@ jQuery.fn.extend( { ...@@ -485,7 +474,7 @@ jQuery.fn.extend( {
var dequeue = true, var dequeue = true,
index = type != null && type + "queueHooks", index = type != null && type + "queueHooks",
timers = jQuery.timers, timers = jQuery.timers,
data = jQuery._data( this ); data = dataPriv.get( this );
if ( index ) { if ( index ) {
if ( data[ index ] && data[ index ].stop ) { if ( data[ index ] && data[ index ].stop ) {
...@@ -509,9 +498,9 @@ jQuery.fn.extend( { ...@@ -509,9 +498,9 @@ jQuery.fn.extend( {
} }
} }
// start the next in the queue if the last step wasn't forced // Start the next in the queue if the last step wasn't forced.
// timers currently will call their complete callbacks, which will dequeue // Timers currently will call their complete callbacks, which
// but only if they were gotoEnd // will dequeue but only if they were gotoEnd.
if ( dequeue || !gotoEnd ) { if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type ); jQuery.dequeue( this, type );
} }
...@@ -523,23 +512,23 @@ jQuery.fn.extend( { ...@@ -523,23 +512,23 @@ jQuery.fn.extend( {
} }
return this.each( function() { return this.each( function() {
var index, var index,
data = jQuery._data( this ), data = dataPriv.get( this ),
queue = data[ type + "queue" ], queue = data[ type + "queue" ],
hooks = data[ type + "queueHooks" ], hooks = data[ type + "queueHooks" ],
timers = jQuery.timers, timers = jQuery.timers,
length = queue ? queue.length : 0; length = queue ? queue.length : 0;
// enable finishing flag on private data // Enable finishing flag on private data
data.finish = true; data.finish = true;
// empty the queue first // Empty the queue first
jQuery.queue( this, type, [] ); jQuery.queue( this, type, [] );
if ( hooks && hooks.stop ) { if ( hooks && hooks.stop ) {
hooks.stop.call( this, true ); hooks.stop.call( this, true );
} }
// look for any active animations, and finish them // Look for any active animations, and finish them
for ( index = timers.length; index--; ) { for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && timers[ index ].queue === type ) { if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
timers[ index ].anim.stop( true ); timers[ index ].anim.stop( true );
...@@ -547,14 +536,14 @@ jQuery.fn.extend( { ...@@ -547,14 +536,14 @@ jQuery.fn.extend( {
} }
} }
// look for any animations in the old queue and finish them // Look for any animations in the old queue and finish them
for ( index = 0; index < length; index++ ) { for ( index = 0; index < length; index++ ) {
if ( queue[ index ] && queue[ index ].finish ) { if ( queue[ index ] && queue[ index ].finish ) {
queue[ index ].finish.call( this ); queue[ index ].finish.call( this );
} }
} }
// turn off finishing flag // Turn off finishing flag
delete data.finish; delete data.finish;
} ); } );
} }
...@@ -586,8 +575,8 @@ jQuery.each( { ...@@ -586,8 +575,8 @@ jQuery.each( {
jQuery.timers = []; jQuery.timers = [];
jQuery.fx.tick = function() { jQuery.fx.tick = function() {
var timer, var timer,
timers = jQuery.timers, i = 0,
i = 0; timers = jQuery.timers;
fxNow = jQuery.now(); fxNow = jQuery.now();
...@@ -616,7 +605,6 @@ jQuery.fx.timer = function( timer ) { ...@@ -616,7 +605,6 @@ jQuery.fx.timer = function( timer ) {
}; };
jQuery.fx.interval = 13; jQuery.fx.interval = 13;
jQuery.fx.start = function() { jQuery.fx.start = function() {
if ( !timerId ) { if ( !timerId ) {
timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval ); timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
...@@ -625,6 +613,7 @@ jQuery.fx.start = function() { ...@@ -625,6 +613,7 @@ jQuery.fx.start = function() {
jQuery.fx.stop = function() { jQuery.fx.stop = function() {
window.clearInterval( timerId ); window.clearInterval( timerId );
timerId = null; timerId = null;
}; };
......
...@@ -66,10 +66,10 @@ Tween.propHooks = { ...@@ -66,10 +66,10 @@ Tween.propHooks = {
return tween.elem[ tween.prop ]; return tween.elem[ tween.prop ];
} }
// passing an empty string as a 3rd parameter to .css will automatically // Passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails // attempt a parseFloat and fallback to a string if the parse fails.
// so, simple values such as "10px" are parsed to Float. // Simple values such as "10px" are parsed to Float;
// complex values such as "rotate(1rad)" are returned as is. // complex values such as "rotate(1rad)" are returned as-is.
result = jQuery.css( tween.elem, tween.prop, "" ); result = jQuery.css( tween.elem, tween.prop, "" );
// Empty strings, null, undefined and "auto" are converted to 0. // Empty strings, null, undefined and "auto" are converted to 0.
...@@ -77,8 +77,9 @@ Tween.propHooks = { ...@@ -77,8 +77,9 @@ Tween.propHooks = {
}, },
set: function( tween ) { set: function( tween ) {
// use step hook for back compat - use cssHook if its there - use .style if its // Use step hook for back compat.
// available and use plain properties where available // Use cssHook if its there.
// Use .style if available and use plain properties where available.
if ( jQuery.fx.step[ tween.prop ] ) { if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween ); jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.nodeType === 1 && } else if ( tween.elem.nodeType === 1 &&
...@@ -92,9 +93,8 @@ Tween.propHooks = { ...@@ -92,9 +93,8 @@ Tween.propHooks = {
} }
}; };
// Support: IE <=9 // Support: IE9
// Panic based approach to setting things on disconnected nodes // Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) { set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) { if ( tween.elem.nodeType && tween.elem.parentNode ) {
......
...@@ -2,20 +2,16 @@ define( [ ...@@ -2,20 +2,16 @@ define( [
"./core", "./core",
"./var/document", "./var/document",
"./var/rnotwhite", "./var/rnotwhite",
"./var/hasOwn",
"./var/slice", "./var/slice",
"./event/support", "./data/var/dataPriv",
"./data/var/acceptData",
"./core/init", "./core/init",
"./data",
"./selector" "./selector"
], function( jQuery, document, rnotwhite, hasOwn, slice, support, acceptData ) { ], function( jQuery, document, rnotwhite, slice, dataPriv ) {
var rformElems = /^(?:input|select|textarea)$/i, var
rkeyEvent = /^key/, rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)/; rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() { function returnTrue() {
...@@ -104,10 +100,11 @@ jQuery.event = { ...@@ -104,10 +100,11 @@ jQuery.event = {
global: {}, global: {},
add: function( elem, types, handler, data, selector ) { add: function( elem, types, handler, data, selector ) {
var tmp, events, t, handleObjIn,
special, eventHandle, handleObj, var handleObjIn, eventHandle, tmp,
handlers, type, namespaces, origType, events, t, handleObj,
elemData = jQuery._data( elem ); special, handlers, type, namespaces, origType,
elemData = dataPriv.get( elem );
// Don't attach events to noData or text/comment nodes (but allow plain objects) // Don't attach events to noData or text/comment nodes (but allow plain objects)
if ( !elemData ) { if ( !elemData ) {
...@@ -135,15 +132,9 @@ jQuery.event = { ...@@ -135,15 +132,9 @@ jQuery.event = {
// Discard the second event of a jQuery.event.trigger() and // Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded // when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
( !e || jQuery.event.triggered !== e.type ) ? jQuery.event.dispatch.apply( elem, arguments ) : undefined;
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
}; };
// Add elem as a property of the handle fn to prevent a memory leak
// with IE non-native events
eventHandle.elem = elem;
} }
// Handle multiple events separated by a space // Handle multiple events separated by a space
...@@ -185,16 +176,12 @@ jQuery.event = { ...@@ -185,16 +176,12 @@ jQuery.event = {
handlers = events[ type ] = []; handlers = events[ type ] = [];
handlers.delegateCount = 0; handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false // Only use addEventListener if the special events handler returns false
if ( !special.setup || if ( !special.setup ||
special.setup.call( elem, data, namespaces, eventHandle ) === false ) { special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) { if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false ); elem.addEventListener( type, eventHandle );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
} }
} }
} }
...@@ -218,17 +205,15 @@ jQuery.event = { ...@@ -218,17 +205,15 @@ jQuery.event = {
jQuery.event.global[ type ] = true; jQuery.event.global[ type ] = true;
} }
// Nullify elem to prevent memory leaks in IE
elem = null;
}, },
// Detach an event or set of events from an element // Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) { remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp,
origCount, t, events, var j, origCount, tmp,
special, handlers, type, events, t, handleObj,
namespaces, origType, special, handlers, type, namespaces, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem ); elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
if ( !elemData || !( events = elemData.events ) ) { if ( !elemData || !( events = elemData.events ) ) {
return; return;
...@@ -290,161 +275,12 @@ jQuery.event = { ...@@ -290,161 +275,12 @@ jQuery.event = {
} }
} }
// Remove the expando if it's no longer used // Remove data and the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) { if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle; dataPriv.remove( elem, "handle events" );
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery._removeData( elem, "events" );
} }
}, },
trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur,
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = hasOwn.call( event, "type" ) ? event.type : event,
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf( "." ) > -1 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split( "." );
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf( ":" ) < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join( "." );
event.rnamespace = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
null;
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === ( elem.ownerDocument || document ) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] &&
jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && handle.apply && acceptData( cur ) ) {
event.result = handle.apply( cur, data );
if ( event.result === false ) {
event.preventDefault();
}
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if (
( !special._default ||
special._default.apply( eventPath.pop(), data ) === false
) && acceptData( elem )
) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
try {
elem[ type ]();
} catch ( e ) {
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
}
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
dispatch: function( event ) { dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object // Make a writable jQuery.Event from the native event object
...@@ -453,7 +289,7 @@ jQuery.event = { ...@@ -453,7 +289,7 @@ jQuery.event = {
var i, j, ret, matched, handleObj, var i, j, ret, matched, handleObj,
handlerQueue = [], handlerQueue = [],
args = slice.call( arguments ), args = slice.call( arguments ),
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {}; special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event // Use the fix-ed jQuery.Event rather than the (read-only) native event
...@@ -520,9 +356,7 @@ jQuery.event = { ...@@ -520,9 +356,7 @@ jQuery.event = {
if ( delegateCount && cur.nodeType && if ( delegateCount && cur.nodeType &&
( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
/* jshint eqeqeq: false */ for ( ; cur !== this; cur = cur.parentNode || this ) {
for ( ; cur != this; cur = cur.parentNode || this ) {
/* jshint eqeqeq: true */
// Don't check non-elements (#13208) // Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
...@@ -558,52 +392,6 @@ jQuery.event = { ...@@ -558,52 +392,6 @@ jQuery.event = {
return handlerQueue; return handlerQueue;
}, },
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop, copy,
type = event.type,
originalEvent = event,
fixHook = this.fixHooks[ type ];
if ( !fixHook ) {
this.fixHooks[ type ] = fixHook =
rmouseEvent.test( type ) ? this.mouseHooks :
rkeyEvent.test( type ) ? this.keyHooks :
{};
}
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = new jQuery.Event( originalEvent );
i = copy.length;
while ( i-- ) {
prop = copy[ i ];
event[ prop ] = originalEvent[ prop ];
}
// Support: IE<9
// Fix target property (#1925)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Support: Safari 6-8+
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// Support: IE<9
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
event.metaKey = !!event.metaKey;
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
},
// Includes some event props shared by KeyEvent and MouseEvent // Includes some event props shared by KeyEvent and MouseEvent
props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " +
"metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ),
...@@ -624,12 +412,11 @@ jQuery.event = { ...@@ -624,12 +412,11 @@ jQuery.event = {
}, },
mouseHooks: { mouseHooks: {
props: ( "button buttons clientX clientY fromElement offsetX offsetY " + props: ( "button buttons clientX clientY offsetX offsetY pageX pageY " +
"pageX pageY screenX screenY toElement" ).split( " " ), "screenX screenY toElement" ).split( " " ),
filter: function( event, original ) { filter: function( event, original ) {
var body, eventDoc, doc, var eventDoc, doc, body,
button = original.button, button = original.button;
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available // Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) { if ( event.pageX == null && original.clientX != null ) {
...@@ -645,13 +432,6 @@ jQuery.event = { ...@@ -645,13 +432,6 @@ jQuery.event = {
( doc && doc.clientTop || body && body.clientTop || 0 ); ( doc && doc.clientTop || body && body.clientTop || 0 );
} }
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ?
original.toElement :
fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right // Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it // Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) { if ( !event.which && button !== undefined ) {
...@@ -662,6 +442,48 @@ jQuery.event = { ...@@ -662,6 +442,48 @@ jQuery.event = {
} }
}, },
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop, copy,
type = event.type,
originalEvent = event,
fixHook = this.fixHooks[ type ];
if ( !fixHook ) {
this.fixHooks[ type ] = fixHook =
rmouseEvent.test( type ) ? this.mouseHooks :
rkeyEvent.test( type ) ? this.keyHooks :
{};
}
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = new jQuery.Event( originalEvent );
i = copy.length;
while ( i-- ) {
prop = copy[ i ];
event[ prop ] = originalEvent[ prop ];
}
// Support: Cordova 2.5 (WebKit) (#13255)
// All events should have a target; Cordova deviceready doesn't
if ( !event.target ) {
event.target = document;
}
// Support: Safari 6.0+, Chrome<28
// Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
},
special: { special: {
load: { load: {
...@@ -673,15 +495,8 @@ jQuery.event = { ...@@ -673,15 +495,8 @@ jQuery.event = {
// Fire native event if possible so blur/focus sequence is correct // Fire native event if possible so blur/focus sequence is correct
trigger: function() { trigger: function() {
if ( this !== safeActiveElement() && this.focus ) { if ( this !== safeActiveElement() && this.focus ) {
try { this.focus();
this.focus(); return false;
return false;
} catch ( e ) {
// Support: IE<9
// If we error on focus to hidden element (#1486, #12518),
// let .trigger() run the handlers
}
} }
}, },
delegateType: "focusin" delegateType: "focusin"
...@@ -699,7 +514,7 @@ jQuery.event = { ...@@ -699,7 +514,7 @@ jQuery.event = {
// For checkbox, fire native event so checked state will be right // For checkbox, fire native event so checked state will be right
trigger: function() { trigger: function() {
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
this.click(); this.click();
return false; return false;
} }
...@@ -721,59 +536,16 @@ jQuery.event = { ...@@ -721,59 +536,16 @@ jQuery.event = {
} }
} }
} }
},
// Piggyback on a donor event to simulate a different one
simulate: function( type, elem, event ) {
var e = jQuery.extend(
new jQuery.Event(),
event,
{
type: type,
isSimulated: true
// Previously, `originalEvent: {}` was set here, so stopPropagation call
// would not be triggered on donor event, since in our own
// jQuery.event.stopPropagation function we had a check for existence of
// originalEvent.stopPropagation method, so, consequently it would be a noop.
//
// Guard for simulated events was moved to jQuery.event.stopPropagation function
// since `originalEvent` should point to the original event for the
// constancy with other events and for more focused logic
}
);
jQuery.event.trigger( e, null, elem );
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
} }
}; };
jQuery.removeEvent = document.removeEventListener ? jQuery.removeEvent = function( elem, type, handle ) {
function( elem, type, handle ) {
// This "if" is needed for plain objects
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event,
// to properly expose it to GC
if ( typeof elem[ name ] === "undefined" ) {
elem[ name ] = null;
}
elem.detachEvent( name, handle ); // This "if" is needed for plain objects
} if ( elem.removeEventListener ) {
}; elem.removeEventListener( type, handle );
}
};
jQuery.Event = function( src, props ) { jQuery.Event = function( src, props ) {
...@@ -792,7 +564,7 @@ jQuery.Event = function( src, props ) { ...@@ -792,7 +564,7 @@ jQuery.Event = function( src, props ) {
this.isDefaultPrevented = src.defaultPrevented || this.isDefaultPrevented = src.defaultPrevented ||
src.defaultPrevented === undefined && src.defaultPrevented === undefined &&
// Support: IE < 9, Android < 4.0 // Support: Android<4.0
src.returnValue === false ? src.returnValue === false ?
returnTrue : returnTrue :
returnFalse; returnFalse;
...@@ -826,18 +598,9 @@ jQuery.Event.prototype = { ...@@ -826,18 +598,9 @@ jQuery.Event.prototype = {
var e = this.originalEvent; var e = this.originalEvent;
this.isDefaultPrevented = returnTrue; this.isDefaultPrevented = returnTrue;
if ( !e ) {
return;
}
// If preventDefault exists, run it on the original event if ( e ) {
if ( e.preventDefault ) {
e.preventDefault(); e.preventDefault();
// Support: IE
// Otherwise set the returnValue property of the original event to false
} else {
e.returnValue = false;
} }
}, },
stopPropagation: function() { stopPropagation: function() {
...@@ -845,25 +608,16 @@ jQuery.Event.prototype = { ...@@ -845,25 +608,16 @@ jQuery.Event.prototype = {
this.isPropagationStopped = returnTrue; this.isPropagationStopped = returnTrue;
if ( !e || this.isSimulated ) { if ( e ) {
return;
}
// If stopPropagation exists, run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation(); e.stopPropagation();
} }
// Support: IE
// Set the cancelBubble property of the original event to true
e.cancelBubble = true;
}, },
stopImmediatePropagation: function() { stopImmediatePropagation: function() {
var e = this.originalEvent; var e = this.originalEvent;
this.isImmediatePropagationStopped = returnTrue; this.isImmediatePropagationStopped = returnTrue;
if ( e && e.stopImmediatePropagation ) { if ( e ) {
e.stopImmediatePropagation(); e.stopImmediatePropagation();
} }
...@@ -907,173 +661,7 @@ jQuery.each( { ...@@ -907,173 +661,7 @@ jQuery.each( {
}; };
} ); } );
// IE submit delegation
if ( !support.submit ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ?
// Support: IE <=8
// We use jQuery.prop instead of elem.form
// to allow fixing the IE8 delegated submit issue (gh-2332)
// by 3rd party polyfills/workarounds.
jQuery.prop( elem, "form" ) :
undefined;
if ( form && !jQuery._data( form, "submit" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submitBubble = true;
} );
jQuery._data( form, "submit", true );
}
} );
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submitBubble ) {
delete event._submitBubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !support.change ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._justChanged = true;
}
} );
jQuery.event.add( this, "click._change", function( event ) {
if ( this._justChanged && !event.isTrigger ) {
this._justChanged = false;
}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event );
} );
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event );
}
} );
jQuery._data( elem, "change", true );
}
} );
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger ||
( elem.type !== "radio" && elem.type !== "checkbox" ) ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return !rformElems.test( this.nodeName );
}
};
}
// Support: Firefox
// Firefox doesn't have focus(in | out) events
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
//
// Support: Chrome, Safari
// focus(in | out) events fire after focus & blur events,
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
if ( !support.focusin ) {
jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler on the document while someone wants focusin/focusout
var handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
};
jQuery.event.special[ fix ] = {
setup: function() {
var doc = this.ownerDocument || this,
attaches = jQuery._data( doc, fix );
if ( !attaches ) {
doc.addEventListener( orig, handler, true );
}
jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
},
teardown: function() {
var doc = this.ownerDocument || this,
attaches = jQuery._data( doc, fix ) - 1;
if ( !attaches ) {
doc.removeEventListener( orig, handler, true );
jQuery._removeData( doc, fix );
} else {
jQuery._data( doc, fix, attaches );
}
}
};
} );
}
jQuery.fn.extend( { jQuery.fn.extend( {
on: function( types, selector, data, fn ) { on: function( types, selector, data, fn ) {
return on( this, types, selector, data, fn ); return on( this, types, selector, data, fn );
}, },
...@@ -1115,18 +703,6 @@ jQuery.fn.extend( { ...@@ -1115,18 +703,6 @@ jQuery.fn.extend( {
return this.each( function() { return this.each( function() {
jQuery.event.remove( this, types, fn, selector ); jQuery.event.remove( this, types, fn, selector );
} ); } );
},
trigger: function( type, data ) {
return this.each( function() {
jQuery.event.trigger( type, data, this );
} );
},
triggerHandler: function( type, data ) {
var elem = this[ 0 ];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
} }
} ); } );
......
define( [ define( [
"../core", "../core",
"../event"
"../event",
"./trigger"
], function( jQuery ) { ], function( jQuery ) {
jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " + jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
......
define( [ define( [
"../var/document",
"../var/support" "../var/support"
], function( document, support ) { ], function( support ) {
( function() { support.focusin = "onfocusin" in window;
var i, eventName,
div = document.createElement( "div" );
// Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events)
for ( i in { submit: true, change: true, focusin: true } ) {
eventName = "on" + i;
if ( !( support[ i ] = eventName in window ) ) {
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
div.setAttribute( eventName, "t" );
support[ i ] = div.attributes[ eventName ].expando === false;
}
}
// Null elements to avoid leaks in IE.
div = null;
} )();
return support; return support;
......
...@@ -18,8 +18,8 @@ jQuery.noConflict = function( deep ) { ...@@ -18,8 +18,8 @@ jQuery.noConflict = function( deep ) {
return jQuery; return jQuery;
}; };
// Expose jQuery and $ identifiers, even in // Expose jQuery and $ identifiers, even in AMD
// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566) // and CommonJS for browser emulators (#13566)
if ( !noGlobal ) { if ( !noGlobal ) {
window.jQuery = window.$ = jQuery; window.jQuery = window.$ = jQuery;
......
...@@ -5,13 +5,13 @@ define( [ ...@@ -5,13 +5,13 @@ define( [
"./callbacks", "./callbacks",
"./deferred", "./deferred",
"./core/ready", "./core/ready",
"./support",
"./data", "./data",
"./queue", "./queue",
"./queue/delay", "./queue/delay",
"./attributes", "./attributes",
"./event", "./event",
"./event/alias", "./event/alias",
"./event/focusin",
"./manipulation", "./manipulation",
"./manipulation/_evalUrl", "./manipulation/_evalUrl",
"./wrap", "./wrap",
......
define( [ define( [
"./core", "./core",
"./var/document",
"./var/concat", "./var/concat",
"./var/push", "./var/push",
"./var/deletedIds",
"./core/access", "./core/access",
"./manipulation/var/rcheckableType", "./manipulation/var/rcheckableType",
"./manipulation/var/rtagName", "./manipulation/var/rtagName",
"./manipulation/var/rscriptType", "./manipulation/var/rscriptType",
"./manipulation/var/rleadingWhitespace",
"./manipulation/var/nodeNames",
"./manipulation/createSafeFragment",
"./manipulation/wrapMap", "./manipulation/wrapMap",
"./manipulation/getAll", "./manipulation/getAll",
"./manipulation/setGlobalEval", "./manipulation/setGlobalEval",
"./manipulation/buildFragment", "./manipulation/buildFragment",
"./manipulation/support", "./manipulation/support",
"./data/var/dataPriv",
"./data/var/dataUser",
"./data/var/acceptData", "./data/var/acceptData",
"./core/init", "./core/init",
"./traversing", "./traversing",
"./selector", "./selector",
"./event" "./event"
], function( jQuery, document, concat, push, deletedIds, access, ], function( jQuery, concat, push, access,
rcheckableType, rtagName, rscriptType, rleadingWhitespace, nodeNames, rcheckableType, rtagName, rscriptType,
createSafeFragment, wrapMap, getAll, setGlobalEval, wrapMap, getAll, setGlobalEval, buildFragment, support,
buildFragment, support, acceptData ) { dataPriv, dataUser, acceptData ) {
var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, var
rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ),
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
// Support: IE 10-11, Edge 10240+ // Support: IE 10-11, Edge 10240+
...@@ -40,11 +36,8 @@ var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, ...@@ -40,11 +36,8 @@ var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
// checked="checked" or checked // checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptTypeMasked = /^true\/(.*)/, rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) );
// Support: IE<8
// Manipulating tables requires a tbody // Manipulating tables requires a tbody
function manipulationTarget( elem, content ) { function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) && return jQuery.nodeName( elem, "table" ) &&
...@@ -57,109 +50,64 @@ function manipulationTarget( elem, content ) { ...@@ -57,109 +50,64 @@ function manipulationTarget( elem, content ) {
// Replace/restore the type attribute of script elements for safe DOM manipulation // Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) { function disableScript( elem ) {
elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type; elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
return elem; return elem;
} }
function restoreScript( elem ) { function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type ); var match = rscriptTypeMasked.exec( elem.type );
if ( match ) { if ( match ) {
elem.type = match[ 1 ]; elem.type = match[ 1 ];
} else { } else {
elem.removeAttribute( "type" ); elem.removeAttribute( "type" );
} }
return elem; return elem;
} }
function cloneCopyEvent( src, dest ) { function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) { if ( dest.nodeType !== 1 ) {
return; return;
} }
nodeName = dest.nodeName.toLowerCase(); // 1. Copy private data: events, handlers, etc.
if ( dataPriv.hasData( src ) ) {
pdataOld = dataPriv.access( src );
pdataCur = dataPriv.set( dest, pdataOld );
events = pdataOld.events;
// IE6-8 copies events bound via attachEvent when using cloneNode. if ( events ) {
if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { delete pdataCur.handle;
data = jQuery._data( dest ); pdataCur.events = {};
for ( e in data.events ) { for ( type in events ) {
jQuery.removeEvent( dest, e, data.handle ); for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
} }
// Event data gets referenced instead of copied if the expando gets copied too
dest.removeAttribute( jQuery.expando );
} }
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text // 2. Copy user data
if ( nodeName === "script" && dest.text !== src.text ) { if ( dataUser.hasData( src ) ) {
disableScript( dest ).text = src.text; udataOld = dataUser.access( src );
restoreScript( dest ); udataCur = jQuery.extend( {}, udataOld );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked = dest.checked = src.checked; dataUser.set( dest, udataCur );
}
}
// IE6-7 get confused and end up setting the value of a cloned // Fix IE bugs, see support tests
// checkbox/radio button to an empty string instead of "on" function fixInput( src, dest ) {
if ( dest.value !== src.value ) { var nodeName = dest.nodeName.toLowerCase();
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected // Fails to persist the checked state of a cloned checkbox or radio button.
// state when cloning options if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
} else if ( nodeName === "option" ) { dest.checked = src.checked;
dest.defaultSelected = dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when // Fails to return the selected option to the default selected state when cloning options
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) { } else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue; dest.defaultValue = src.defaultValue;
} }
...@@ -170,8 +118,7 @@ function domManip( collection, args, callback, ignored ) { ...@@ -170,8 +118,7 @@ function domManip( collection, args, callback, ignored ) {
// Flatten any nested arrays // Flatten any nested arrays
args = concat.apply( [], args ); args = concat.apply( [], args );
var first, node, hasScripts, var fragment, first, scripts, hasScripts, node, doc,
scripts, doc, fragment,
i = 0, i = 0,
l = collection.length, l = collection.length,
iNoClone = l - 1, iNoClone = l - 1,
...@@ -235,7 +182,7 @@ function domManip( collection, args, callback, ignored ) { ...@@ -235,7 +182,7 @@ function domManip( collection, args, callback, ignored ) {
for ( i = 0; i < hasScripts; i++ ) { for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ]; node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) && if ( rscriptType.test( node.type || "" ) &&
!jQuery._data( node, "globalEval" ) && !dataPriv.access( node, "globalEval" ) &&
jQuery.contains( doc, node ) ) { jQuery.contains( doc, node ) ) {
if ( node.src ) { if ( node.src ) {
...@@ -245,17 +192,11 @@ function domManip( collection, args, callback, ignored ) { ...@@ -245,17 +192,11 @@ function domManip( collection, args, callback, ignored ) {
jQuery._evalUrl( node.src ); jQuery._evalUrl( node.src );
} }
} else { } else {
jQuery.globalEval( jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
( node.text || node.textContent || node.innerHTML || "" )
.replace( rcleanScript, "" )
);
} }
} }
} }
} }
// Fix #11809: Avoid leaking memory
fragment = first = null;
} }
} }
...@@ -264,11 +205,10 @@ function domManip( collection, args, callback, ignored ) { ...@@ -264,11 +205,10 @@ function domManip( collection, args, callback, ignored ) {
function remove( elem, selector, keepData ) { function remove( elem, selector, keepData ) {
var node, var node,
elems = selector ? jQuery.filter( selector, elem ) : elem, nodes = selector ? jQuery.filter( selector, elem ) : elem,
i = 0; i = 0;
for ( ; ( node = elems[ i ] ) != null; i++ ) { for ( ; ( node = nodes[ i ] ) != null; i++ ) {
if ( !keepData && node.nodeType === 1 ) { if ( !keepData && node.nodeType === 1 ) {
jQuery.cleanData( getAll( node ) ); jQuery.cleanData( getAll( node ) );
} }
...@@ -290,34 +230,20 @@ jQuery.extend( { ...@@ -290,34 +230,20 @@ jQuery.extend( {
}, },
clone: function( elem, dataAndEvents, deepDataAndEvents ) { clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements, var i, l, srcElements, destElements,
clone = elem.cloneNode( true ),
inPage = jQuery.contains( elem.ownerDocument, elem ); inPage = jQuery.contains( elem.ownerDocument, elem );
if ( support.html5Clone || jQuery.isXMLDoc( elem ) || // Fix IE cloning issues
!rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
!jQuery.isXMLDoc( elem ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
} else {
fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
if ( ( !support.noCloneEvent || !support.noCloneChecked ) &&
( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone ); destElements = getAll( clone );
srcElements = getAll( elem ); srcElements = getAll( elem );
// Fix all IE cloning issues for ( i = 0, l = srcElements.length; i < l; i++ ) {
for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) { fixInput( srcElements[ i ], destElements[ i ] );
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[ i ] ) {
fixCloneNodeIssues( node, destElements[ i ] );
}
} }
} }
...@@ -327,8 +253,8 @@ jQuery.extend( { ...@@ -327,8 +253,8 @@ jQuery.extend( {
srcElements = srcElements || getAll( elem ); srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone ); destElements = destElements || getAll( clone );
for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) { for ( i = 0, l = srcElements.length; i < l; i++ ) {
cloneCopyEvent( node, destElements[ i ] ); cloneCopyEvent( srcElements[ i ], destElements[ i ] );
} }
} else { } else {
cloneCopyEvent( elem, clone ); cloneCopyEvent( elem, clone );
...@@ -341,27 +267,18 @@ jQuery.extend( { ...@@ -341,27 +267,18 @@ jQuery.extend( {
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
} }
destElements = srcElements = node = null;
// Return the cloned set // Return the cloned set
return clone; return clone;
}, },
cleanData: function( elems, /* internal */ forceAcceptData ) { cleanData: function( elems ) {
var elem, type, id, data, var data, elem, type,
i = 0, special = jQuery.event.special,
internalKey = jQuery.expando, i = 0;
cache = jQuery.cache,
attributes = support.attributes,
special = jQuery.event.special;
for ( ; ( elem = elems[ i ] ) != null; i++ ) {
if ( forceAcceptData || acceptData( elem ) ) {
id = elem[ internalKey ];
data = id && cache[ id ];
if ( data ) { for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
if ( acceptData( elem ) ) {
if ( ( data = elem[ dataPriv.expando ] ) ) {
if ( data.events ) { if ( data.events ) {
for ( type in data.events ) { for ( type in data.events ) {
if ( special[ type ] ) { if ( special[ type ] ) {
...@@ -374,27 +291,15 @@ jQuery.extend( { ...@@ -374,27 +291,15 @@ jQuery.extend( {
} }
} }
// Remove cache only if it was not already removed by jQuery.event.remove // Support: Chrome <= 35-45+
if ( cache[ id ] ) { // Assign undefined instead of using delete, see Data#remove
elem[ dataPriv.expando ] = undefined;
delete cache[ id ]; }
if ( elem[ dataUser.expando ] ) {
// Support: IE<9
// IE does not allow us to delete expando properties from nodes
// IE creates expando attributes along with the property
// IE does not have a removeAttribute function on Document nodes
if ( !attributes && typeof elem.removeAttribute !== "undefined" ) {
elem.removeAttribute( internalKey );
// Webkit & Blink performance suffers when deleting properties
// from DOM nodes, so set to undefined instead
// https://code.google.com/p/chromium/issues/detail?id=378607
} else {
elem[ internalKey ] = undefined;
}
deletedIds.push( id ); // Support: Chrome <= 35-45+
} // Assign undefined instead of using delete, see Data#remove
elem[ dataUser.expando ] = undefined;
} }
} }
} }
...@@ -418,9 +323,11 @@ jQuery.fn.extend( { ...@@ -418,9 +323,11 @@ jQuery.fn.extend( {
return access( this, function( value ) { return access( this, function( value ) {
return value === undefined ? return value === undefined ?
jQuery.text( this ) : jQuery.text( this ) :
this.empty().append( this.empty().each( function() {
( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
); this.textContent = value;
}
} );
}, null, value, arguments.length ); }, null, value, arguments.length );
}, },
...@@ -463,21 +370,13 @@ jQuery.fn.extend( { ...@@ -463,21 +370,13 @@ jQuery.fn.extend( {
i = 0; i = 0;
for ( ; ( elem = this[ i ] ) != null; i++ ) { for ( ; ( elem = this[ i ] ) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) { if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
}
// Remove any remaining nodes // Prevent memory leaks
while ( elem.firstChild ) { jQuery.cleanData( getAll( elem, false ) );
elem.removeChild( elem.firstChild );
}
// If this is a select, ensure that it displays empty (#12336) // Remove any remaining nodes
// Support: IE<9 elem.textContent = "";
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
elem.options.length = 0;
} }
} }
...@@ -499,25 +398,21 @@ jQuery.fn.extend( { ...@@ -499,25 +398,21 @@ jQuery.fn.extend( {
i = 0, i = 0,
l = this.length; l = this.length;
if ( value === undefined ) { if ( value === undefined && elem.nodeType === 1 ) {
return elem.nodeType === 1 ? return elem.innerHTML;
elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined;
} }
// See if we can take a shortcut and just use innerHTML // See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) && if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
value = jQuery.htmlPrefilter( value ); value = jQuery.htmlPrefilter( value );
try { try {
for ( ; i < l; i++ ) { for ( ; i < l; i++ ) {
elem = this[ i ] || {};
// Remove element nodes and prevent memory leaks // Remove element nodes and prevent memory leaks
elem = this[ i ] || {};
if ( elem.nodeType === 1 ) { if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) ); jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value; elem.innerHTML = value;
...@@ -564,16 +459,17 @@ jQuery.each( { ...@@ -564,16 +459,17 @@ jQuery.each( {
}, function( name, original ) { }, function( name, original ) {
jQuery.fn[ name ] = function( selector ) { jQuery.fn[ name ] = function( selector ) {
var elems, var elems,
i = 0,
ret = [], ret = [],
insert = jQuery( selector ), insert = jQuery( selector ),
last = insert.length - 1; last = insert.length - 1,
i = 0;
for ( ; i <= last; i++ ) { for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone( true ); elems = i === last ? this : this.clone( true );
jQuery( insert[ i ] )[ original ]( elems ); jQuery( insert[ i ] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() // Support: QtWebKit
// .get() because push.apply(_, arraylike) throws
push.apply( ret, elems.get() ); push.apply( ret, elems.get() );
} }
......
...@@ -9,7 +9,6 @@ jQuery._evalUrl = function( url ) { ...@@ -9,7 +9,6 @@ jQuery._evalUrl = function( url ) {
// Make this explicit, since user can override this through ajaxSetup (#11264) // Make this explicit, since user can override this through ajaxSetup (#11264)
type: "GET", type: "GET",
dataType: "script", dataType: "script",
cache: true,
async: false, async: false,
global: false, global: false,
"throws": true "throws": true
......
define( [ define( [
"../core", "../core",
"./var/rcheckableType",
"./var/rtagName", "./var/rtagName",
"./var/rscriptType", "./var/rscriptType",
"./var/rleadingWhitespace",
"./createSafeFragment",
"./wrapMap", "./wrapMap",
"./getAll", "./getAll",
"./setGlobalEval", "./setGlobalEval"
"./support" ], function( jQuery, rtagName, rscriptType, wrapMap, getAll, setGlobalEval ) {
], function( jQuery, rcheckableType, rtagName, rscriptType, rleadingWhitespace,
createSafeFragment, wrapMap, getAll, setGlobalEval, support ) {
var rhtml = /<|&#?\w+;/, var rhtml = /<|&#?\w+;/;
rtbody = /<tbody/i;
function fixDefaultChecked( elem ) {
if ( rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
function buildFragment( elems, context, scripts, selection, ignored ) { function buildFragment( elems, context, scripts, selection, ignored ) {
var j, elem, contains, var elem, tmp, tag, wrap, contains, j,
tmp, tag, tbody, wrap, fragment = context.createDocumentFragment(),
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [], nodes = [],
i = 0; i = 0,
l = elems.length;
for ( ; i < l; i++ ) { for ( ; i < l; i++ ) {
elem = elems[ i ]; elem = elems[ i ];
...@@ -39,6 +23,9 @@ function buildFragment( elems, context, scripts, selection, ignored ) { ...@@ -39,6 +23,9 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
// Add nodes directly // Add nodes directly
if ( jQuery.type( elem ) === "object" ) { if ( jQuery.type( elem ) === "object" ) {
// Support: Android<4.1, PhantomJS<2
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node // Convert non-html into a text node
...@@ -47,12 +34,11 @@ function buildFragment( elems, context, scripts, selection, ignored ) { ...@@ -47,12 +34,11 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
// Convert html into DOM nodes // Convert html into DOM nodes
} else { } else {
tmp = tmp || safe.appendChild( context.createElement( "div" ) ); tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
// Deserialize a standard representation // Deserialize a standard representation
tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default; wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
// Descend through wrappers to the right content // Descend through wrappers to the right content
...@@ -61,59 +47,21 @@ function buildFragment( elems, context, scripts, selection, ignored ) { ...@@ -61,59 +47,21 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
tmp = tmp.lastChild; tmp = tmp.lastChild;
} }
// Manually add leading whitespace removed by IE // Support: Android<4.1, PhantomJS<2
if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { // push.apply(_, arraylike) throws on ancient WebKit
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) );
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
elem = tag === "table" && !rtbody.test( elem ) ?
tmp.firstChild :
// String was a bare <thead> or <tfoot>
wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) &&
!tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes ); jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9 // Remember the top-level container
tmp.textContent = ""; tmp = fragment.firstChild;
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild );
}
// Remember the top-level container for proper cleanup // Ensure the created nodes are orphaned (#12392)
tmp = safe.lastChild; tmp.textContent = "";
} }
} }
} }
// Fix #11356: Clear elements from fragment // Remove wrapper from fragment
if ( tmp ) { fragment.textContent = "";
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
}
i = 0; i = 0;
while ( ( elem = nodes[ i++ ] ) ) { while ( ( elem = nodes[ i++ ] ) ) {
...@@ -123,14 +71,13 @@ function buildFragment( elems, context, scripts, selection, ignored ) { ...@@ -123,14 +71,13 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
if ( ignored ) { if ( ignored ) {
ignored.push( elem ); ignored.push( elem );
} }
continue; continue;
} }
contains = jQuery.contains( elem.ownerDocument, elem ); contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment // Append to fragment
tmp = getAll( safe.appendChild( elem ), "script" ); tmp = getAll( fragment.appendChild( elem ), "script" );
// Preserve script evaluation history // Preserve script evaluation history
if ( contains ) { if ( contains ) {
...@@ -148,9 +95,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) { ...@@ -148,9 +95,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
} }
} }
tmp = null; return fragment;
return safe;
} }
return buildFragment; return buildFragment;
......
...@@ -3,30 +3,18 @@ define( [ ...@@ -3,30 +3,18 @@ define( [
], function( jQuery ) { ], function( jQuery ) {
function getAll( context, tag ) { function getAll( context, tag ) {
var elems, elem,
i = 0, // Support: IE9-11+
found = typeof context.getElementsByTagName !== "undefined" ? // Use typeof to avoid zero-argument method invocation on host objects (#15151)
var ret = typeof context.getElementsByTagName !== "undefined" ?
context.getElementsByTagName( tag || "*" ) : context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== "undefined" ? typeof context.querySelectorAll !== "undefined" ?
context.querySelectorAll( tag || "*" ) : context.querySelectorAll( tag || "*" ) :
undefined; [];
if ( !found ) {
for ( found = [], elems = context.childNodes || context;
( elem = elems[ i ] ) != null;
i++
) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ? return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) : jQuery.merge( [ context ], ret ) :
found; ret;
} }
return getAll; return getAll;
......
define( [ define( [
"../core" "../data/var/dataPriv"
], function( jQuery ) { ], function( dataPriv ) {
// Mark scripts as having already been evaluated // Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) { function setGlobalEval( elems, refElements ) {
var elem, var i = 0,
i = 0; l = elems.length;
for ( ; ( elem = elems[ i ] ) != null; i++ ) {
jQuery._data( for ( ; i < l; i++ ) {
elem, dataPriv.set(
elems[ i ],
"globalEval", "globalEval",
!refElements || jQuery._data( refElements[ i ], "globalEval" ) !refElements || dataPriv.get( refElements[ i ], "globalEval" )
); );
} }
} }
......
define( [ define( [
"../core",
"../var/document", "../var/document",
"../var/support" "../var/support"
], function( jQuery, document, support ) { ], function( document, support ) {
( function() { ( function() {
var div = document.createElement( "div" ), var fragment = document.createDocumentFragment(),
fragment = document.createDocumentFragment(), div = fragment.appendChild( document.createElement( "div" ) ),
input = document.createElement( "input" ); input = document.createElement( "input" );
// Setup // Support: Android 4.0-4.3, Safari<=5.1
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; // Check state lost if the name is set (#11217)
// IE strips leading whitespace when .innerHTML is used
support.leadingWhitespace = div.firstChild.nodeType === 3;
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
support.tbody = !div.getElementsByTagName( "tbody" ).length;
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
support.html5Clone =
document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
input.type = "checkbox";
input.checked = true;
fragment.appendChild( input );
support.appendChecked = input.checked;
// Make sure textarea (and checkbox) defaultValue is properly cloned
// Support: IE6-IE11+
div.innerHTML = "<textarea>x</textarea>";
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
// #11217 - WebKit loses check when the name is after the checked attribute
fragment.appendChild( div );
// Support: Windows Web Apps (WWA) // Support: Windows Web Apps (WWA)
// `name` and `type` must use .setAttribute for WWA (#14901) // `name` and `type` must use .setAttribute for WWA (#14901)
input = document.createElement( "input" );
input.setAttribute( "type", "radio" ); input.setAttribute( "type", "radio" );
input.setAttribute( "checked", "checked" ); input.setAttribute( "checked", "checked" );
input.setAttribute( "name", "t" ); input.setAttribute( "name", "t" );
div.appendChild( input ); div.appendChild( input );
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 // Support: Safari<=5.1, Android<4.2
// old WebKit doesn't clone checked state correctly in fragments // Older WebKit doesn't clone checked state correctly in fragments
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE<9 // Support: IE<=11+
// Cloned elements keep attachEvent handlers, we use addEventListener on IE9+ // Make sure textarea (and checkbox) defaultValue is properly cloned
support.noCloneEvent = !!div.addEventListener; div.innerHTML = "<textarea>x</textarea>";
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
// Support: IE<9
// Since attributes and properties are the same in IE,
// cleanData must set properties to undefined rather than use removeAttribute
div[ jQuery.expando ] = 1;
support.attributes = !div.getAttribute( jQuery.expando );
} )(); } )();
return support; return support;
......
define( [ define( function() {
"./support"
], function( support ) {
// We have to close these tags to support XHTML (#13200) // We have to close these tags to support XHTML (#13200)
var wrapMap = { var wrapMap = {
// Support: IE9
option: [ 1, "<select multiple='multiple'>", "</select>" ], option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
area: [ 1, "<map>", "</map>" ],
// Support: IE8 // XHTML parsers do not magically insert elements in the
param: [ 1, "<object>", "</object>" ], // same way that tag soup parsers do. So we cannot shorten
// this by omitting <tbody> or other required elements.
thead: [ 1, "<table>", "</table>" ], thead: [ 1, "<table>", "</table>" ],
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, _default: [ 0, "", "" ]
// unless wrapped in a div with non-breaking characters in front of it.
_default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
}; };
// Support: IE8-IE9 // Support: IE9
wrapMap.optgroup = wrapMap.option; wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
......
...@@ -13,18 +13,11 @@ define( [ ...@@ -13,18 +13,11 @@ define( [
"./selector" // contains "./selector" // contains
], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support ) { ], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support ) {
// BuildExclude
curCSS = curCSS.curCSS;
/** /**
* Gets a window from an element * Gets a window from an element
*/ */
function getWindow( elem ) { function getWindow( elem ) {
return jQuery.isWindow( elem ) ? return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
} }
jQuery.offset = { jQuery.offset = {
...@@ -34,7 +27,7 @@ jQuery.offset = { ...@@ -34,7 +27,7 @@ jQuery.offset = {
curElem = jQuery( elem ), curElem = jQuery( elem ),
props = {}; props = {};
// set position first, in-case top/left are set even on static elem // Set position first, in-case top/left are set even on static elem
if ( position === "static" ) { if ( position === "static" ) {
elem.style.position = "relative"; elem.style.position = "relative";
} }
...@@ -43,14 +36,15 @@ jQuery.offset = { ...@@ -43,14 +36,15 @@ jQuery.offset = {
curCSSTop = jQuery.css( elem, "top" ); curCSSTop = jQuery.css( elem, "top" );
curCSSLeft = jQuery.css( elem, "left" ); curCSSLeft = jQuery.css( elem, "left" );
calculatePosition = ( position === "absolute" || position === "fixed" ) && calculatePosition = ( position === "absolute" || position === "fixed" ) &&
jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1; ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
// need to be able to calculate position if either top or left // Need to be able to calculate position if either
// is auto and position is either absolute or fixed // top or left is auto and position is either absolute or fixed
if ( calculatePosition ) { if ( calculatePosition ) {
curPosition = curElem.position(); curPosition = curElem.position();
curTop = curPosition.top; curTop = curPosition.top;
curLeft = curPosition.left; curLeft = curPosition.left;
} else { } else {
curTop = parseFloat( curCSSTop ) || 0; curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0; curLeft = parseFloat( curCSSLeft ) || 0;
...@@ -71,6 +65,7 @@ jQuery.offset = { ...@@ -71,6 +65,7 @@ jQuery.offset = {
if ( "using" in options ) { if ( "using" in options ) {
options.using.call( elem, props ); options.using.call( elem, props );
} else { } else {
curElem.css( props ); curElem.css( props );
} }
...@@ -88,8 +83,8 @@ jQuery.fn.extend( { ...@@ -88,8 +83,8 @@ jQuery.fn.extend( {
} }
var docElem, win, var docElem, win,
box = { top: 0, left: 0 },
elem = this[ 0 ], elem = this[ 0 ],
box = { top: 0, left: 0 },
doc = elem && elem.ownerDocument; doc = elem && elem.ownerDocument;
if ( !doc ) { if ( !doc ) {
...@@ -103,15 +98,11 @@ jQuery.fn.extend( { ...@@ -103,15 +98,11 @@ jQuery.fn.extend( {
return box; return box;
} }
// If we don't have gBCR, just use 0,0 rather than error box = elem.getBoundingClientRect();
// BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== "undefined" ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc ); win = getWindow( doc );
return { return {
top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), top: box.top + win.pageYOffset - docElem.clientTop,
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) left: box.left + win.pageXOffset - docElem.clientLeft
}; };
}, },
...@@ -121,15 +112,16 @@ jQuery.fn.extend( { ...@@ -121,15 +112,16 @@ jQuery.fn.extend( {
} }
var offsetParent, offset, var offsetParent, offset,
parentOffset = { top: 0, left: 0 }, elem = this[ 0 ],
elem = this[ 0 ]; parentOffset = { top: 0, left: 0 };
// Fixed elements are offset from window (parentOffset = {top:0, left: 0}, // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
// because it is its only offset parent // because it is its only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) { if ( jQuery.css( elem, "position" ) === "fixed" ) {
// we assume that getBoundingClientRect is available when computed position is fixed // Assume getBoundingClientRect is there when computed position is fixed
offset = elem.getBoundingClientRect(); offset = elem.getBoundingClientRect();
} else { } else {
// Get *real* offsetParent // Get *real* offsetParent
...@@ -142,27 +134,35 @@ jQuery.fn.extend( { ...@@ -142,27 +134,35 @@ jQuery.fn.extend( {
} }
// Add offsetParent borders // Add offsetParent borders
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
} }
// Subtract parent offsets and element margins // Subtract parent offsets and element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
return { return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
}; };
}, },
// This method will return documentElement in the following cases:
// 1) For the element inside the iframe without offsetParent, this method will return
// documentElement of the parent window
// 2) For the hidden or detached element
// 3) For body or html element, i.e. in case of the html node - it will return itself
//
// but those exceptions were never presented as a real life use-cases
// and might be considered as more preferable results.
//
// This logic, however, is not guaranteed and can change at any point in the future
offsetParent: function() { offsetParent: function() {
return this.map( function() { return this.map( function() {
var offsetParent = this.offsetParent; var offsetParent = this.offsetParent;
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
jQuery.css( offsetParent, "position" ) === "static" ) ) {
offsetParent = offsetParent.offsetParent; offsetParent = offsetParent.offsetParent;
} }
return offsetParent || documentElement; return offsetParent || documentElement;
} ); } );
} }
...@@ -170,43 +170,42 @@ jQuery.fn.extend( { ...@@ -170,43 +170,42 @@ jQuery.fn.extend( {
// Create scrollLeft and scrollTop methods // Create scrollLeft and scrollTop methods
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
var top = /Y/.test( prop ); var top = "pageYOffset" === prop;
jQuery.fn[ method ] = function( val ) { jQuery.fn[ method ] = function( val ) {
return access( this, function( elem, method, val ) { return access( this, function( elem, method, val ) {
var win = getWindow( elem ); var win = getWindow( elem );
if ( val === undefined ) { if ( val === undefined ) {
return win ? ( prop in win ) ? win[ prop ] : return win ? win[ prop ] : elem[ method ];
win.document.documentElement[ method ] :
elem[ method ];
} }
if ( win ) { if ( win ) {
win.scrollTo( win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(), !top ? val : win.pageXOffset,
top ? val : jQuery( win ).scrollTop() top ? val : win.pageYOffset
); );
} else { } else {
elem[ method ] = val; elem[ method ] = val;
} }
}, method, val, arguments.length, null ); }, method, val, arguments.length );
}; };
} ); } );
// Support: Safari<7-8+, Chrome<37-44+ // Support: Safari<7-8+, Chrome<37-44+
// Add the top/left cssHooks using jQuery.fn.position // Add the top/left cssHooks using jQuery.fn.position
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280
// rather than make the css module depend on the offset module, we just check for it here // getComputedStyle returns percent when specified for top/left/bottom/right;
// rather than make the css module depend on the offset module, just check for it here
jQuery.each( [ "top", "left" ], function( i, prop ) { jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
function( elem, computed ) { function( elem, computed ) {
if ( computed ) { if ( computed ) {
computed = curCSS( elem, prop ); computed = curCSS( elem, prop );
// if curCSS returns percentage, fallback to offset // If curCSS returns percentage, fallback to offset
return rnumnonpx.test( computed ) ? return rnumnonpx.test( computed ) ?
jQuery( elem ).position()[ prop ] + "px" : jQuery( elem ).position()[ prop ] + "px" :
computed; computed;
......
define( [ define( [
"./core", "./core",
"./data/var/dataPriv",
"./deferred", "./deferred",
"./callbacks" "./callbacks"
], function( jQuery ) { ], function( jQuery, dataPriv ) {
jQuery.extend( { jQuery.extend( {
queue: function( elem, type, data ) { queue: function( elem, type, data ) {
...@@ -10,12 +11,12 @@ jQuery.extend( { ...@@ -10,12 +11,12 @@ jQuery.extend( {
if ( elem ) { if ( elem ) {
type = ( type || "fx" ) + "queue"; type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type ); queue = dataPriv.get( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup // Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) { if ( data ) {
if ( !queue || jQuery.isArray( data ) ) { if ( !queue || jQuery.isArray( data ) ) {
queue = jQuery._data( elem, type, jQuery.makeArray( data ) ); queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
} else { } else {
queue.push( data ); queue.push( data );
} }
...@@ -49,7 +50,7 @@ jQuery.extend( { ...@@ -49,7 +50,7 @@ jQuery.extend( {
queue.unshift( "inprogress" ); queue.unshift( "inprogress" );
} }
// clear up the last queue stop function // Clear up the last queue stop function
delete hooks.stop; delete hooks.stop;
fn.call( elem, next, hooks ); fn.call( elem, next, hooks );
} }
...@@ -59,14 +60,12 @@ jQuery.extend( { ...@@ -59,14 +60,12 @@ jQuery.extend( {
} }
}, },
// not intended for public consumption - generates a queueHooks object, // Not public - generate a queueHooks object, or return the current one
// or returns the current one
_queueHooks: function( elem, type ) { _queueHooks: function( elem, type ) {
var key = type + "queueHooks"; var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, { return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
empty: jQuery.Callbacks( "once memory" ).add( function() { empty: jQuery.Callbacks( "once memory" ).add( function() {
jQuery._removeData( elem, type + "queue" ); dataPriv.remove( elem, [ type + "queue", key ] );
jQuery._removeData( elem, key );
} ) } )
} ); } );
} }
...@@ -91,7 +90,7 @@ jQuery.fn.extend( { ...@@ -91,7 +90,7 @@ jQuery.fn.extend( {
this.each( function() { this.each( function() {
var queue = jQuery.queue( this, type, data ); var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue // Ensure a hooks for this queue
jQuery._queueHooks( this, type ); jQuery._queueHooks( this, type );
if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
...@@ -129,7 +128,7 @@ jQuery.fn.extend( { ...@@ -129,7 +128,7 @@ jQuery.fn.extend( {
type = type || "fx"; type = type || "fx";
while ( i-- ) { while ( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" ); tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) { if ( tmp && tmp.empty ) {
count++; count++;
tmp.empty.add( resolve ); tmp.empty.add( resolve );
......
...@@ -102,7 +102,7 @@ jQuery.fn.extend( { ...@@ -102,7 +102,7 @@ jQuery.fn.extend( {
.filter( function() { .filter( function() {
var type = this.type; var type = this.type;
// Use .is(":disabled") so that fieldset[disabled] works // Use .is( ":disabled" ) so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) && return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !rcheckableType.test( type ) ); ( this.checked || !rcheckableType.test( type ) );
......
define( [ define( [
"./core", "./core",
"./var/indexOf",
"./traversing/var/dir", "./traversing/var/dir",
"./traversing/var/siblings", "./traversing/var/siblings",
"./traversing/var/rneedsContext", "./traversing/var/rneedsContext",
"./core/init", "./core/init",
"./traversing/findFilter", "./traversing/findFilter",
"./selector" "./selector"
], function( jQuery, dir, siblings, rneedsContext ) { ], function( jQuery, indexOf, dir, siblings, rneedsContext ) {
var rparentsprev = /^(?:parents|prev(?:Until|All))/, var rparentsprev = /^(?:parents|prev(?:Until|All))/,
// methods guaranteed to produce a unique set when starting from a unique set // Methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = { guaranteedUnique = {
children: true, children: true,
contents: true, contents: true,
...@@ -20,12 +21,12 @@ var rparentsprev = /^(?:parents|prev(?:Until|All))/, ...@@ -20,12 +21,12 @@ var rparentsprev = /^(?:parents|prev(?:Until|All))/,
jQuery.fn.extend( { jQuery.fn.extend( {
has: function( target ) { has: function( target ) {
var i, var targets = jQuery( target, this ),
targets = jQuery( target, this ), l = targets.length;
len = targets.length;
return this.filter( function() { return this.filter( function() {
for ( i = 0; i < len; i++ ) { var i = 0;
for ( ; i < l; i++ ) {
if ( jQuery.contains( this, targets[ i ] ) ) { if ( jQuery.contains( this, targets[ i ] ) ) {
return true; return true;
} }
...@@ -62,8 +63,7 @@ jQuery.fn.extend( { ...@@ -62,8 +63,7 @@ jQuery.fn.extend( {
return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
}, },
// Determine the position of an element within // Determine the position of an element within the set
// the matched set of elements
index: function( elem ) { index: function( elem ) {
// No argument, return index in parent // No argument, return index in parent
...@@ -71,16 +71,17 @@ jQuery.fn.extend( { ...@@ -71,16 +71,17 @@ jQuery.fn.extend( {
return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
} }
// index in selector // Index in selector
if ( typeof elem === "string" ) { if ( typeof elem === "string" ) {
return jQuery.inArray( this[ 0 ], jQuery( elem ) ); return indexOf.call( jQuery( elem ), this[ 0 ] );
} }
// Locate the position of the desired element // Locate the position of the desired element
return jQuery.inArray( return indexOf.call( this,
// If it receives a jQuery object, the first element is used // If it receives a jQuery object, the first element is used
elem.jquery ? elem[ 0 ] : elem, this ); elem.jquery ? elem[ 0 ] : elem
);
}, },
add: function( selector, context ) { add: function( selector, context ) {
...@@ -99,10 +100,7 @@ jQuery.fn.extend( { ...@@ -99,10 +100,7 @@ jQuery.fn.extend( {
} ); } );
function sibling( cur, dir ) { function sibling( cur, dir ) {
do { while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur; return cur;
} }
...@@ -142,36 +140,34 @@ jQuery.each( { ...@@ -142,36 +140,34 @@ jQuery.each( {
return siblings( elem.firstChild ); return siblings( elem.firstChild );
}, },
contents: function( elem ) { contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ? return elem.contentDocument || jQuery.merge( [], elem.childNodes );
elem.contentDocument || elem.contentWindow.document :
jQuery.merge( [], elem.childNodes );
} }
}, function( name, fn ) { }, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) { jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until ); var matched = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) { if ( name.slice( -5 ) !== "Until" ) {
selector = until; selector = until;
} }
if ( selector && typeof selector === "string" ) { if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret ); matched = jQuery.filter( selector, matched );
} }
if ( this.length > 1 ) { if ( this.length > 1 ) {
// Remove duplicates // Remove duplicates
if ( !guaranteedUnique[ name ] ) { if ( !guaranteedUnique[ name ] ) {
ret = jQuery.uniqueSort( ret ); jQuery.uniqueSort( matched );
} }
// Reverse order for parents* and prev-derivatives // Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) { if ( rparentsprev.test( name ) ) {
ret = ret.reverse(); matched.reverse();
} }
} }
return this.pushStack( ret ); return this.pushStack( matched );
}; };
} ); } );
......
...@@ -33,7 +33,7 @@ function winnow( elements, qualifier, not ) { ...@@ -33,7 +33,7 @@ function winnow( elements, qualifier, not ) {
} }
return jQuery.grep( elements, function( elem ) { return jQuery.grep( elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not; return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
} ); } );
} }
...@@ -54,9 +54,9 @@ jQuery.filter = function( expr, elems, not ) { ...@@ -54,9 +54,9 @@ jQuery.filter = function( expr, elems, not ) {
jQuery.fn.extend( { jQuery.fn.extend( {
find: function( selector ) { find: function( selector ) {
var i, var i,
len = this.length,
ret = [], ret = [],
self = this, self = this;
len = self.length;
if ( typeof selector !== "string" ) { if ( typeof selector !== "string" ) {
return this.pushStack( jQuery( selector ).filter( function() { return this.pushStack( jQuery( selector ).filter( function() {
......
define( [ define( [
"./deletedIds" "./arr"
], function( deletedIds ) { ], function( arr ) {
return deletedIds.concat; return arr.concat;
} ); } );
define( [ define( [
"./deletedIds" "./arr"
], function( deletedIds ) { ], function( arr ) {
return deletedIds.indexOf; return arr.indexOf;
} ); } );
define( [ define( [
"./deletedIds" "./arr"
], function( deletedIds ) { ], function( arr ) {
return deletedIds.push; return arr.push;
} ); } );
define( [ define( [
"./deletedIds" "./arr"
], function( deletedIds ) { ], function( arr ) {
return deletedIds.slice; return arr.slice;
} ); } );
...@@ -7,6 +7,8 @@ define( [ ...@@ -7,6 +7,8 @@ define( [
jQuery.fn.extend( { jQuery.fn.extend( {
wrapAll: function( html ) { wrapAll: function( html ) {
var wrap;
if ( jQuery.isFunction( html ) ) { if ( jQuery.isFunction( html ) ) {
return this.each( function( i ) { return this.each( function( i ) {
jQuery( this ).wrapAll( html.call( this, i ) ); jQuery( this ).wrapAll( html.call( this, i ) );
...@@ -16,7 +18,7 @@ jQuery.fn.extend( { ...@@ -16,7 +18,7 @@ jQuery.fn.extend( {
if ( this[ 0 ] ) { if ( this[ 0 ] ) {
// The elements to wrap the target around // The elements to wrap the target around
var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
if ( this[ 0 ].parentNode ) { if ( this[ 0 ].parentNode ) {
wrap.insertBefore( this[ 0 ] ); wrap.insertBefore( this[ 0 ] );
...@@ -25,8 +27,8 @@ jQuery.fn.extend( { ...@@ -25,8 +27,8 @@ jQuery.fn.extend( {
wrap.map( function() { wrap.map( function() {
var elem = this; var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { while ( elem.firstElementChild ) {
elem = elem.firstChild; elem = elem.firstElementChild;
} }
return elem; return elem;
......
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