Commit 56ead6ff authored by Timmy Willison's avatar Timmy Willison

Release 1.12.1

parent 514cf3e4
...@@ -6,10 +6,10 @@ Michael Geary <mike@geary.com> ...@@ -6,10 +6,10 @@ Michael Geary <mike@geary.com>
Stefan Petre <stefan.petre@gmail.com> Stefan Petre <stefan.petre@gmail.com>
Yehuda Katz <wycats@gmail.com> Yehuda Katz <wycats@gmail.com>
Corey Jewett <cj@syntheticplayground.com> Corey Jewett <cj@syntheticplayground.com>
Klaus Hartl <klaus.hartl@gmail.com> Klaus Hartl <klaus.hartl@googlemail.com>
Franck Marcia <franck.marcia@gmail.com> Franck Marcia <franck.marcia@gmail.com>
Jörn Zaefferer <joern.zaefferer@gmail.com> Jörn Zaefferer <joern.zaefferer@gmail.com>
Paul Bakaus <paul.bakaus@gmail.com> Paul Bakaus <paul.bakaus@googlemail.com>
Brandon Aaron <brandon.aaron@gmail.com> Brandon Aaron <brandon.aaron@gmail.com>
Mike Alsup <malsup@gmail.com> Mike Alsup <malsup@gmail.com>
Dave Methvin <dave.methvin@gmail.com> Dave Methvin <dave.methvin@gmail.com>
...@@ -47,7 +47,7 @@ Matt Curry <matt@pseudocoder.com> ...@@ -47,7 +47,7 @@ Matt Curry <matt@pseudocoder.com>
Michael Monteleone <michael@michaelmonteleone.net> Michael Monteleone <michael@michaelmonteleone.net>
Noah Sloan <noah.sloan@gmail.com> Noah Sloan <noah.sloan@gmail.com>
Tom Viner <github@viner.tv> Tom Viner <github@viner.tv>
Douglas Neiner <doug@dougneiner.com> Douglas Neiner <doug@pixelgraphics.us>
Adam J. Sontag <ajpiano@ajpiano.com> Adam J. Sontag <ajpiano@ajpiano.com>
Dave Reed <dareed@microsoft.com> Dave Reed <dareed@microsoft.com>
Ralph Whitbeck <ralph.whitbeck@gmail.com> Ralph Whitbeck <ralph.whitbeck@gmail.com>
...@@ -57,7 +57,7 @@ J. Ryan Stinnett <jryans@gmail.com> ...@@ -57,7 +57,7 @@ J. Ryan Stinnett <jryans@gmail.com>
unknown <Igen005@.upcorp.ad.uprr.com> unknown <Igen005@.upcorp.ad.uprr.com>
temp01 <temp01irc@gmail.com> temp01 <temp01irc@gmail.com>
Heungsub Lee <h@subl.ee> Heungsub Lee <h@subl.ee>
Colin Snover <github.com@zetafleet.com> Colin Snover <colin@alpha.zetafleet.com>
Ryan W Tenney <ryan@10e.us> Ryan W Tenney <ryan@10e.us>
Pinhook <contact@pinhooklabs.com> Pinhook <contact@pinhooklabs.com>
Ron Otten <r.j.g.otten@gmail.com> Ron Otten <r.j.g.otten@gmail.com>
...@@ -69,7 +69,7 @@ Henri Wiechers <hwiechers@gmail.com> ...@@ -69,7 +69,7 @@ Henri Wiechers <hwiechers@gmail.com>
Russell Holbrook <russell.holbrook@patch.com> Russell Holbrook <russell.holbrook@patch.com>
Julian Aubourg <aubourg.julian@gmail.com> Julian Aubourg <aubourg.julian@gmail.com>
Gianni Alessandro Chiappetta <gianni@runlevel6.org> Gianni Alessandro Chiappetta <gianni@runlevel6.org>
Scott Jehl <scottjehl@gmail.com> Scott Jehl <scott@scottjehl.com>
James Burke <jrburke@gmail.com> James Burke <jrburke@gmail.com>
Jonas Pfenniger <jonas@pfenniger.name> Jonas Pfenniger <jonas@pfenniger.name>
Xavi Ramirez <xavi.rmz@gmail.com> Xavi Ramirez <xavi.rmz@gmail.com>
...@@ -78,10 +78,10 @@ Sylvester Keil <sylvester@keil.or.at> ...@@ -78,10 +78,10 @@ Sylvester Keil <sylvester@keil.or.at>
Brandon Sterne <bsterne@mozilla.com> Brandon Sterne <bsterne@mozilla.com>
Mathias Bynens <mathias@qiwi.be> Mathias Bynens <mathias@qiwi.be>
Timmy Willison <timmywillisn@gmail.com> Timmy Willison <timmywillisn@gmail.com>
Corey Frang <gnarf37@gmail.com> Corey Frang <gnarf@gnarf.net>
Digitalxero <digitalxero> Digitalxero <digitalxero>
Anton Kovalyov <anton@kovalyov.net> Anton Kovalyov <anton@kovalyov.net>
David Murdoch <david@davidmurdoch.com> David Murdoch <musicisair@yahoo.com>
Josh Varner <josh.varner@gmail.com> Josh Varner <josh.varner@gmail.com>
Charles McNulty <cmcnulty@kznf.com> Charles McNulty <cmcnulty@kznf.com>
Jordan Boesch <jboesch26@gmail.com> Jordan Boesch <jboesch26@gmail.com>
...@@ -139,7 +139,7 @@ Chris Faulkner <thefaulkner@gmail.com> ...@@ -139,7 +139,7 @@ Chris Faulkner <thefaulkner@gmail.com>
Elijah Manor <elijah.manor@gmail.com> Elijah Manor <elijah.manor@gmail.com>
Daniel Chatfield <chatfielddaniel@gmail.com> Daniel Chatfield <chatfielddaniel@gmail.com>
Nikita Govorov <nikita.govorov@gmail.com> Nikita Govorov <nikita.govorov@gmail.com>
Wesley Walser <waw325@gmail.com> Wesley Walser <wwalser@atlassian.com>
Mike Pennisi <mike@mikepennisi.com> Mike Pennisi <mike@mikepennisi.com>
Markus Staab <markus.staab@redaxo.de> Markus Staab <markus.staab@redaxo.de>
Dave Riddle <david@joyvuu.com> Dave Riddle <david@joyvuu.com>
...@@ -170,8 +170,6 @@ Paul Ramos <paul.b.ramos@gmail.com> ...@@ -170,8 +170,6 @@ Paul Ramos <paul.b.ramos@gmail.com>
Rod Vagg <rod@vagg.org> Rod Vagg <rod@vagg.org>
Bennett Sorbo <bsorbo@gmail.com> Bennett Sorbo <bsorbo@gmail.com>
Sebastian Burkhard <sebi.burkhard@gmail.com> Sebastian Burkhard <sebi.burkhard@gmail.com>
Zachary Adam Kaplan <razic@viralkitty.com>
nanto_vi <nanto@moon.email.ne.jp>
nanto <nanto@moon.email.ne.jp> nanto <nanto@moon.email.ne.jp>
Danil Somsikov <danilasomsikov@gmail.com> Danil Somsikov <danilasomsikov@gmail.com>
Ryunosuke SATO <tricknotes.rs@gmail.com> Ryunosuke SATO <tricknotes.rs@gmail.com>
...@@ -179,70 +177,62 @@ Jean Boussier <jean.boussier@gmail.com> ...@@ -179,70 +177,62 @@ Jean Boussier <jean.boussier@gmail.com>
Adam Coulombe <me@adam.co> Adam Coulombe <me@adam.co>
Andrew Plummer <plummer.andrew@gmail.com> Andrew Plummer <plummer.andrew@gmail.com>
Mark Raddatz <mraddatz@gmail.com> Mark Raddatz <mraddatz@gmail.com>
Isaac Z. Schlueter <i@izs.me>
Karl Sieburg <ksieburg@yahoo.com>
Pascal Borreli <pascal@borreli.com>
Nguyen Phuc Lam <ruado1987@gmail.com>
Dmitry Gusev <dmitry.gusev@gmail.com> Dmitry Gusev <dmitry.gusev@gmail.com>
Michał Gołębiowski <m.goleb@gmail.com> Michał Gołębiowski <m.goleb@gmail.com>
Li Xudong <istonelee@gmail.com> Nguyen Phuc Lam <ruado1987@gmail.com>
Steven Benner <admin@stevenbenner.com>
Tom H Fuertes <tomfuertes@gmail.com> Tom H Fuertes <tomfuertes@gmail.com>
Renato Oliveira dos Santos <ros3@cin.ufpe.br> Brandon Johnson <bjohn465+github@gmail.com>
ros3cin <ros3@cin.ufpe.br>
Jason Bedard <jason+jquery@jbedard.ca> Jason Bedard <jason+jquery@jbedard.ca>
Kyle Robinson Young <kyle@dontkry.com> Kyle Robinson Young <kyle@dontkry.com>
Renato Oliveira dos Santos <ros3@cin.ufpe.br>
Chris Talkington <chris@talkingtontech.com> Chris Talkington <chris@talkingtontech.com>
Eddie Monge <eddie@eddiemonge.com> Eddie Monge <eddie@eddiemonge.com>
Terry Jones <terry@jon.es> Terry Jones <terry@jon.es>
Jason Merino <jasonmerino@gmail.com> Jason Merino <jasonmerino@gmail.com>
Jeremy Dunck <jdunck@gmail.com> Jeremy Dunck <jdunck@gmail.com>
Chris Price <price.c@gmail.com> Chris Price <price.c@gmail.com>
Guy Bedford <guybedford@gmail.com>
Amey Sakhadeo <me@ameyms.com> Amey Sakhadeo <me@ameyms.com>
Mike Sidorov <mikes.ekb@gmail.com>
Anthony Ryan <anthonyryan1@gmail.com> Anthony Ryan <anthonyryan1@gmail.com>
Dominik D. Geyer <dominik.geyer@gmail.com> Dominik D. Geyer <dominik.geyer@gmail.com>
George Kats <katsgeorgeek@gmail.com> George Kats <katsgeorgeek@gmail.com>
Lihan Li <frankieteardrop@gmail.com> Lihan Li <frankieteardrop@gmail.com>
Ronny Springer <springer.ronny@gmail.com> Ronny Springer <springer.ronny@gmail.com>
Chris Antaki <ChrisAntaki@gmail.com>
Marian Sollmann <marian.sollmann@cargomedia.ch> Marian Sollmann <marian.sollmann@cargomedia.ch>
njhamann <njhamann@gmail.com> Corey Frang <gnarf37@gmail.com>
Ilya Kantor <iliakan@gmail.com> Chris Antaki <ChrisAntaki@gmail.com>
Noah Hamann <njhamann@gmail.com>
David Hong <d.hong@me.com> David Hong <d.hong@me.com>
John Paul <john@johnkpaul.com>
Jakob Stoeck <jakob@pokermania.de> Jakob Stoeck <jakob@pokermania.de>
Christopher Jones <chris@cjqed.com> Christopher Jones <christopherjonesqed@gmail.com>
Forbes Lindesay <forbes@lindesay.co.uk> Forbes Lindesay <forbes@lindesay.co.uk>
John Paul <john@johnkpaul.com>
S. Andrew Sheppard <andrew@wq.io> S. Andrew Sheppard <andrew@wq.io>
Leonardo Balter <leonardo.balter@gmail.com> Leonardo Balter <leonardo.balter@gmail.com>
Roman Reiß <me@silverwind.io> Roman Reiß <me@silverwind.io>
Benjy Cui <benjytrys@gmail.com> Benjy Cui <benjytrys@gmail.com>
Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com> Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
John Hoven <hovenj@gmail.com> John Hoven <hovenj@gmail.com>
Philip Jägenstedt <philip@foolip.org>
Christian Kosmowski <ksmwsk@gmail.com> Christian Kosmowski <ksmwsk@gmail.com>
Liang Peng <poppinlp@gmail.com> Liang Peng <poppinlp@gmail.com>
TJ VanToll <tj.vantoll@gmail.com> TJ VanToll <tj.vantoll@gmail.com>
Senya Pugach <upisfree@outlook.com> Senya Pugach <upisfree@outlook.com>
Aurelio De Rosa <aurelioderosa@gmail.com> Aurelio De Rosa <aurelioderosa@gmail.com>
Nazar Mokrynskyi <nazar@mokrynskyi.com> Nazar Mokrynskyi <nazar@mokrynskyi.com>
Amit Merchant <bullredeyes@gmail.com>
Jason Bedard <jason+github@jbedard.ca>
Arthur Verschaeve <contact@arthurverschaeve.be> Arthur Verschaeve <contact@arthurverschaeve.be>
Dan Hart <danhart@notonthehighstreet.com> Dan Hart <danhart@notonthehighstreet.com>
Scott González <scott.gonzalez@gmail.com>
Zheming Sun <mescodasun@gmail.com>
Bin Xin <rhyzix@gmail.com> Bin Xin <rhyzix@gmail.com>
David Corbacho <davidcorbacho@gmail.com> David Corbacho <davidcorbacho@gmail.com>
Veaceslav Grimalschi <grimalschi@yandex.ru> Veaceslav Grimalschi <grimalschi@yandex.ru>
Daniel Husar <dano.husar@gmail.com> Daniel Husar <dano.husar@gmail.com>
Frederic Hemberger <mail@frederic-hemberger.de> Jason Bedard <jason+github@jbedard.ca>
Ben Toews <mastahyeti@gmail.com> Ben Toews <mastahyeti@gmail.com>
Aditya Raghavan <araghavan3@gmail.com> Aditya Raghavan <araghavan3@gmail.com>
Victor Homyakov <vkhomyackov@gmail.com>
Shivaji Varma <contact@shivajivarma.com>
Nicolas HENRY <icewil@gmail.com> Nicolas HENRY <icewil@gmail.com>
Norman Xu <homyu.shinn@gmail.com>
Anne-Gaelle Colom <coloma@westminster.ac.uk> Anne-Gaelle Colom <coloma@westminster.ac.uk>
Victor Homyakov <vkhomyackov@gmail.com>
George Mauer <gmauer@gmail.com> George Mauer <gmauer@gmail.com>
Leonardo Braga <leonardo.braga@gmail.com> Leonardo Braga <leonardo.braga@gmail.com>
Stephen Edgar <stephen@netweb.com.au> Stephen Edgar <stephen@netweb.com.au>
...@@ -256,25 +246,21 @@ Calvin Metcalf <calvin.metcalf@gmail.com> ...@@ -256,25 +246,21 @@ Calvin Metcalf <calvin.metcalf@gmail.com>
Mu Haibao <mhbseal@163.com> Mu Haibao <mhbseal@163.com>
Richard McDaniel <rm0026@uah.edu> Richard McDaniel <rm0026@uah.edu>
Chris Rebert <github@rebertia.com> Chris Rebert <github@rebertia.com>
Gabriel Schulhof <gabriel.schulhof@intel.com>
Gilad Peleg <giladp007@gmail.com> Gilad Peleg <giladp007@gmail.com>
Martin Naumann <martin@geekonaut.de> Martin Naumann <martin@geekonaut.de>
Marek Lewandowski <m.lewandowski@cksource.com>
Bruno Pérel <brunoperel@gmail.com> Bruno Pérel <brunoperel@gmail.com>
Reed Loden <reed@reedloden.com> Reed Loden <reed@reedloden.com>
Daniel Nill <daniellnill@gmail.com> Daniel Nill <daniellnill@gmail.com>
Yongwoo Jeon <yongwoo.jeon@navercorp.com> Yongwoo Jeon <yongwoo.jeon@navercorp.com>
Sean Henderson <seanh.za@gmail.com> Sean Henderson <seanh.za@gmail.com>
Adrian Olek <adrianolek@gmail.com>
Richard Kraaijenhagen <stdin+git@riichard.com> Richard Kraaijenhagen <stdin+git@riichard.com>
Connor Atherton <c.liam.atherton@gmail.com>
Gary Ye <garysye@gmail.com> Gary Ye <garysye@gmail.com>
Christian Grete <webmaster@christiangrete.com> Christian Grete <webmaster@christiangrete.com>
Liza Ramo <liza.h.ramo@gmail.com> Liza Ramo <liza.h.ramo@gmail.com>
Julian Alexander Murillo <julian.alexander.murillo@gmail.com>
Joelle Fleurantin <joasqueeniebee@gmail.com> Joelle Fleurantin <joasqueeniebee@gmail.com>
Jae Sung Park <alberto.park@gmail.com> Julian Alexander Murillo <julian.alexander.murillo@gmail.com>
Jun Sun <klsforever@gmail.com> Jun Sun <klsforever@gmail.com>
Josh Soref <apache@soref.com> Devin Wilson <dwilson6.github@gmail.com>
Henry Wong <henryw4k@gmail.com> Todor Prikumov <tono_pr@abv.bg>
Jon Dufresne <jon.dufresne@gmail.com> Zack Hall <zackhall@outlook.com>
Martijn W. van der Lee <martijn@vanderlee.com>
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
"name": "jquery", "name": "jquery",
"title": "jQuery", "title": "jQuery",
"description": "JavaScript library for DOM operations", "description": "JavaScript library for DOM operations",
"version": "3.0.0-beta1", "version": "1.12.1",
"main": "dist/jquery.js", "main": "dist/jquery.js",
"homepage": "https://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/3.0.0-beta1/AUTHORS.txt" "url": "https://github.com/jquery/jquery/blob/1.12-stable/AUTHORS.txt"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
...@@ -41,14 +41,12 @@ ...@@ -41,14 +41,12 @@
"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",
"native-promise-only": "0.7.8-a", "npm": "2.1.12",
"promises-aplus-tests": "2.1.0",
"q": "1.1.2",
"qunitjs": "1.17.1", "qunitjs": "1.17.1",
"qunit-assert-step": "1.0.3", "qunit-assert-step": "1.0.3",
"requirejs": "2.1.17", "requirejs": "2.1.17",
"sinon": "1.10.3", "sinon": "1.12.2",
"sizzle": "2.3.0", "sizzle": "2.2.1",
"strip-json-comments": "1.0.3", "strip-json-comments": "1.0.3",
"testswarm": "1.1.0", "testswarm": "1.1.0",
"win-spawn": "2.0.0" "win-spawn": "2.0.0"
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"undef": true, "undef": true,
"unused": true, "unused": true,
"evil": true,
"sub": true, "sub": true,
// Support: IE < 10, Android < 4.1 // Support: IE < 10, Android < 4.1
...@@ -22,8 +23,8 @@ ...@@ -22,8 +23,8 @@
"JSON": false, "JSON": false,
"jQuery": true, "jQuery": true,
"define": true, "define": false,
"module": true, "module": false,
"noGlobal": true "noGlobal": true
} }
} }
This diff is collapsed.
...@@ -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 );
} }
......
...@@ -4,19 +4,29 @@ define( [ ...@@ -4,19 +4,29 @@ define( [
"../ajax", "../ajax",
"../traversing", "../traversing",
"../manipulation", "../manipulation",
"../selector" "../selector",
// Optional event/alias dependency
"../event/alias"
], function( jQuery ) { ], function( jQuery ) {
// Keep a copy of the old load method
var _load = jQuery.fn.load;
/** /**
* Load a url into a page * Load a url into a page
*/ */
jQuery.fn.load = function( url, params, callback ) { jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
var selector, type, response, var selector, type, response,
self = this, self = this,
off = url.indexOf( " " ); off = url.indexOf( " " );
if ( off > -1 ) { if ( off > -1 ) {
selector = jQuery.trim( url.slice( off ) ); selector = jQuery.trim( url.slice( off, url.length ) );
url = url.slice( 0, off ); url = url.slice( 0, off );
} }
......
...@@ -2,7 +2,51 @@ define( [ ...@@ -2,7 +2,51 @@ define( [
"../core" "../core"
], function( jQuery ) { ], function( jQuery ) {
jQuery.parseJSON = JSON.parse; var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
jQuery.parseJSON = function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
// Support: Android 2.3
// Workaround failure to string-cast null input
return window.JSON.parse( data + "" );
}
var requireNonComma,
depth = null,
str = jQuery.trim( data + "" );
// Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
// after removing valid tokens
return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) {
// Force termination if we see a misplaced comma
if ( requireNonComma && comma ) {
depth = 0;
}
// Perform no more replacements after returning to outermost depth
if ( depth === 0 ) {
return token;
}
// Commas must not follow "[", "{", or ","
requireNonComma = open || comma;
// Determine new depth
// array/object open ("[" or "{"): depth += true - false (increment)
// array/object close ("]" or "}"): depth += false - true (decrement)
// other cases ("," or primitive): depth += true - true (numeric cast)
depth += !close - !open;
// Remove this token
return "";
} ) ) ?
( Function( "return " + str ) )() :
jQuery.error( "Invalid JSON: " + data );
};
return jQuery.parseJSON; return jQuery.parseJSON;
......
...@@ -4,19 +4,23 @@ define( [ ...@@ -4,19 +4,23 @@ define( [
// Cross-browser xml parsing // Cross-browser xml parsing
jQuery.parseXML = function( data ) { jQuery.parseXML = function( data ) {
var xml; var xml, tmp;
if ( !data || typeof data !== "string" ) { if ( !data || typeof data !== "string" ) {
return null; return null;
} }
// Support: IE9
try { try {
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); if ( window.DOMParser ) { // Standard
tmp = new window.DOMParser();
xml = tmp.parseFromString( data, "text/xml" );
} else { // IE
xml = new window.ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch ( e ) { } catch ( e ) {
xml = undefined; xml = undefined;
} }
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data ); jQuery.error( "Invalid XML: " + data );
} }
return xml; return xml;
......
...@@ -28,13 +28,14 @@ jQuery.ajaxSetup( { ...@@ -28,13 +28,14 @@ jQuery.ajaxSetup( {
} }
} ); } );
// Handle cache's special case and crossDomain // Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) { jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) { if ( s.cache === undefined ) {
s.cache = false; s.cache = false;
} }
if ( s.crossDomain ) { if ( s.crossDomain ) {
s.type = "GET"; s.type = "GET";
s.global = false;
} }
} ); } );
...@@ -43,29 +44,55 @@ jQuery.ajaxTransport( "script", function( s ) { ...@@ -43,29 +44,55 @@ jQuery.ajaxTransport( "script", function( s ) {
// This transport only deals with cross domain requests // This transport only deals with cross domain requests
if ( s.crossDomain ) { if ( s.crossDomain ) {
var script, callback;
var script,
head = document.head || jQuery( "head" )[ 0 ] || document.documentElement;
return { return {
send: function( _, complete ) {
script = jQuery( "<script>" ).prop( { send: function( _, callback ) {
charset: s.scriptCharset,
src: s.url script = document.createElement( "script" );
} ).on(
"load error", script.async = true;
callback = function( evt ) {
script.remove(); if ( s.scriptCharset ) {
callback = null; script.charset = s.scriptCharset;
if ( evt ) { }
complete( evt.type === "error" ? 404 : 200, evt.type );
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( script.parentNode ) {
script.parentNode.removeChild( script );
}
// Dereference the script
script = null;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
} }
} }
); };
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
// Use native DOM manipulation to avoid our domManip AJAX trickery // Use native DOM manipulation to avoid our domManip AJAX trickery
document.head.appendChild( script[ 0 ] ); head.insertBefore( script, head.firstChild );
}, },
abort: function() { abort: function() {
if ( callback ) { if ( script ) {
callback(); script.onload( undefined, true );
} }
} }
}; };
......
This diff is collapsed.
define( [ define( [
"./core", "./core",
"./attributes/val",
"./attributes/attr", "./attributes/attr",
"./attributes/prop", "./attributes/prop",
"./attributes/classes", "./attributes/classes"
"./attributes/val"
], function( jQuery ) { ], function( jQuery ) {
// Return jQuery for attributes-only inclusion // Return jQuery for attributes-only inclusion
......
...@@ -3,18 +3,15 @@ define( [ ...@@ -3,18 +3,15 @@ define( [
"../core/access", "../core/access",
"./support", "./support",
"../var/rnotwhite", "../var/rnotwhite",
"./val",
"../selector" "../selector"
], function( jQuery, access, support, rnotwhite ) { ], function( jQuery, access, support, rnotwhite ) {
var boolHook, var nodeHook, boolHook,
attrHandle = jQuery.expr.attrHandle, attrHandle = jQuery.expr.attrHandle,
ruseDefault = /^(?:checked|selected)$/i,
// Exclusively lowercase A-Z in attribute names (gh-2730) getSetAttribute = support.getSetAttribute,
// https://dom.spec.whatwg.org/#converted-to-ascii-lowercase getSetInput = support.input;
raz = /[A-Z]+/g,
lowercase = function( ch ) {
return ch.toLowerCase();
};
jQuery.fn.extend( { jQuery.fn.extend( {
attr: function( name, value ) { attr: function( name, value ) {
...@@ -46,9 +43,9 @@ jQuery.extend( { ...@@ -46,9 +43,9 @@ jQuery.extend( {
// All attributes are lowercase // All attributes are lowercase
// Grab necessary hook if one is defined // Grab necessary hook if one is defined
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
name = name.replace( raz, lowercase ); name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || hooks = jQuery.attrHooks[ name ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
} }
if ( value !== undefined ) { if ( value !== undefined ) {
...@@ -81,6 +78,9 @@ jQuery.extend( { ...@@ -81,6 +78,9 @@ jQuery.extend( {
set: function( elem, value ) { set: function( elem, value ) {
if ( !support.radioValue && value === "radio" && if ( !support.radioValue && value === "radio" &&
jQuery.nodeName( elem, "input" ) ) { jQuery.nodeName( elem, "input" ) ) {
// Setting the type on a radio button after the value resets the value in IE8-9
// Reset value to default in case type is set after value during creation
var val = elem.value; var val = elem.value;
elem.setAttribute( "type", value ); elem.setAttribute( "type", value );
if ( val ) { if ( val ) {
...@@ -93,13 +93,34 @@ jQuery.extend( { ...@@ -93,13 +93,34 @@ jQuery.extend( {
}, },
removeAttr: function( elem, value ) { removeAttr: function( elem, value ) {
var name, var name, propName,
i = 0, i = 0,
attrNames = value && value.match( rnotwhite ); attrNames = value && value.match( rnotwhite );
if ( attrNames && elem.nodeType === 1 ) { if ( attrNames && elem.nodeType === 1 ) {
while ( ( name = attrNames[ i++ ] ) ) { while ( ( name = attrNames[ i++ ] ) ) {
elem.removeAttribute( name ); propName = jQuery.propFix[ name ] || name;
// Boolean attributes get special treatment (#10870)
if ( jQuery.expr.match.bool.test( name ) ) {
// Set corresponding property to false
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
elem[ propName ] = false;
// Support: IE<9
// Also clear defaultChecked/defaultSelected (if appropriate)
} else {
elem[ jQuery.camelCase( "default-" + name ) ] =
elem[ propName ] = false;
}
// See #9699 for explanation of this approach (setting first, then removal)
} else {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
} }
} }
} }
...@@ -112,8 +133,16 @@ boolHook = { ...@@ -112,8 +133,16 @@ 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;
} }
...@@ -122,20 +151,131 @@ boolHook = { ...@@ -122,20 +151,131 @@ boolHook = {
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
var getter = attrHandle[ name ] || jQuery.find.attr; var getter = attrHandle[ name ] || jQuery.find.attr;
attrHandle[ name ] = function( elem, name, isXML ) { if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
var ret, handle; attrHandle[ name ] = function( elem, name, isXML ) {
if ( !isXML ) { var ret, handle;
if ( !isXML ) {
// Avoid an infinite loop by temporarily removing this function from the getter
handle = attrHandle[ name ]; // Avoid an infinite loop by temporarily removing this function from the getter
attrHandle[ name ] = ret; handle = attrHandle[ name ];
ret = getter( elem, name, isXML ) != null ? attrHandle[ name ] = ret;
name.toLowerCase() : ret = getter( elem, name, isXML ) != null ?
null; name.toLowerCase() :
attrHandle[ name ] = handle; null;
attrHandle[ name ] = handle;
}
return ret;
};
} else {
attrHandle[ name ] = function( elem, name, isXML ) {
if ( !isXML ) {
return elem[ jQuery.camelCase( "default-" + name ) ] ?
name.toLowerCase() :
null;
}
};
}
} );
// fix oldIE attroperties
if ( !getSetInput || !getSetAttribute ) {
jQuery.attrHooks.value = {
set: function( elem, value, name ) {
if ( jQuery.nodeName( elem, "input" ) ) {
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
} }
return ret;
}; };
} ); }
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = {
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
( ret = elem.ownerDocument.createAttribute( name ) )
);
}
ret.value = value += "";
// Break association with cloned elements by also using setAttribute (#9646)
if ( name === "value" || value === elem.getAttribute( name ) ) {
return value;
}
}
};
// Some attributes are constructed with empty-string values when not defined
attrHandle.id = attrHandle.name = attrHandle.coords =
function( elem, name, isXML ) {
var ret;
if ( !isXML ) {
return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ?
ret.value :
null;
}
};
// Fixing value retrieval on a button requires this module
jQuery.valHooks.button = {
get: function( elem, name ) {
var ret = elem.getAttributeNode( name );
if ( ret && ret.specified ) {
return ret.value;
}
},
set: nodeHook.set
};
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
set: function( elem, value, name ) {
nodeHook.set( elem, value === "" ? false : value, name );
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each( [ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
};
} );
}
if ( !support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Note: IE uppercases css property names, but if we were to .toLowerCase()
// .cssText, that would destroy case sensitivity in URL's, like in "background"
return elem.style.cssText || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
} ); } );
define( [ define( [
"../core", "../core",
"../var/rnotwhite", "../var/rnotwhite",
"../data/var/dataPriv",
"../core/init" "../core/init"
], function( jQuery, rnotwhite, dataPriv ) { ], function( jQuery, rnotwhite ) {
var rclass = /[\t\r\n\f]/g; var rclass = /[\t\r\n\f]/g;
function getClass( elem ) { function getClass( elem ) {
return elem.getAttribute && elem.getAttribute( "class" ) || ""; return jQuery.attr( elem, "class" ) || "";
} }
jQuery.fn.extend( { jQuery.fn.extend( {
...@@ -38,10 +37,10 @@ jQuery.fn.extend( { ...@@ -38,10 +37,10 @@ jQuery.fn.extend( {
} }
} }
// Only assign if different to avoid unneeded rendering. // only assign if different to avoid unneeded rendering.
finalValue = jQuery.trim( cur ); finalValue = jQuery.trim( cur );
if ( curValue !== finalValue ) { if ( curValue !== finalValue ) {
elem.setAttribute( "class", finalValue ); jQuery.attr( elem, "class", finalValue );
} }
} }
} }
...@@ -87,7 +86,7 @@ jQuery.fn.extend( { ...@@ -87,7 +86,7 @@ jQuery.fn.extend( {
// Only assign if different to avoid unneeded rendering. // Only assign if different to avoid unneeded rendering.
finalValue = jQuery.trim( cur ); finalValue = jQuery.trim( cur );
if ( curValue !== finalValue ) { if ( curValue !== finalValue ) {
elem.setAttribute( "class", finalValue ); jQuery.attr( elem, "class", finalValue );
} }
} }
} }
...@@ -137,21 +136,19 @@ jQuery.fn.extend( { ...@@ -137,21 +136,19 @@ jQuery.fn.extend( {
className = getClass( this ); className = getClass( this );
if ( className ) { if ( className ) {
// Store className if set // store className if set
dataPriv.set( this, "__className__", className ); jQuery._data( this, "__className__", className );
} }
// If the element has a class name or if we're passed `false`, // If the element has a class name or if we're passed "false",
// then remove the whole classname (if there was one, the above saved it). // then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything), // Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored. // falling back to the empty string if nothing was stored.
if ( this.setAttribute ) { jQuery.attr( this, "class",
this.setAttribute( "class", className || value === false ?
className || value === false ? "" :
"" : jQuery._data( this, "__className__" ) || ""
dataPriv.get( this, "__className__" ) || "" );
);
}
} }
} ); } );
}, },
......
...@@ -5,7 +5,7 @@ define( [ ...@@ -5,7 +5,7 @@ define( [
"../selector" "../selector"
], function( jQuery, access, support ) { ], function( jQuery, access, support ) {
var rfocusable = /^(?:input|select|textarea|button)$/i, var rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i; rclickable = /^(?:a|area)$/i;
jQuery.fn.extend( { jQuery.fn.extend( {
...@@ -14,8 +14,14 @@ jQuery.fn.extend( { ...@@ -14,8 +14,14 @@ jQuery.fn.extend( {
}, },
removeProp: function( name ) { removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each( function() { return this.each( function() {
delete this[ jQuery.propFix[ name ] || name ];
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch ( e ) {}
} ); } );
} }
} ); } );
...@@ -79,12 +85,35 @@ jQuery.extend( { ...@@ -79,12 +85,35 @@ jQuery.extend( {
} }
} ); } );
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !support.hrefNormalized ) {
// href/src property should get the full normalized URL (#10299/#12915)
jQuery.each( [ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
} );
}
// Support: Safari, IE9+
// mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !support.optSelected ) { if ( !support.optSelected ) {
jQuery.propHooks.selected = { jQuery.propHooks.selected = {
get: function( elem ) { get: function( elem ) {
var parent = elem.parentNode; var parent = elem.parentNode;
if ( parent && parent.parentNode ) {
parent.parentNode.selectedIndex; if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
} }
return null; return null;
} }
...@@ -106,4 +135,9 @@ jQuery.each( [ ...@@ -106,4 +135,9 @@ jQuery.each( [
jQuery.propFix[ this.toLowerCase() ] = this; jQuery.propFix[ this.toLowerCase() ] = this;
} ); } );
// IE6/7 call enctype encoding
if ( !support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
} ); } );
...@@ -4,25 +4,64 @@ define( [ ...@@ -4,25 +4,64 @@ define( [
], function( document, support ) { ], function( document, support ) {
( function() { ( function() {
var input = document.createElement( "input" ), var a,
input = document.createElement( "input" ),
div = document.createElement( "div" ),
select = document.createElement( "select" ), select = document.createElement( "select" ),
opt = select.appendChild( document.createElement( "option" ) ); opt = select.appendChild( document.createElement( "option" ) );
input.type = "checkbox"; // Setup
div = document.createElement( "div" );
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
a = div.getElementsByTagName( "a" )[ 0 ];
// Support: Android<4.4 // Support: Windows Web Apps (WWA)
// Default value for a checkbox should be "on" // `type` must use .setAttribute for WWA (#14901)
support.checkOn = input.value !== ""; input.setAttribute( "type", "checkbox" );
div.appendChild( input );
// Support: IE<=11+ a = div.getElementsByTagName( "a" )[ 0 ];
// Must access selectedIndex to make default options select
// First batch of tests.
a.style.cssText = "top:1px";
// Test setAttribute on camelCase class.
// If it works, we need attrFixes when doing get/setAttribute (ie6/7)
support.getSetAttribute = div.className !== "t";
// Get the style information from getAttribute
// (IE uses .cssText instead)
support.style = /top/.test( a.getAttribute( "style" ) );
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
support.hrefNormalized = a.getAttribute( "href" ) === "/a";
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
support.checkOn = !!input.value;
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
support.optSelected = opt.selected; support.optSelected = opt.selected;
// Support: IE<=11+ // Tests for enctype support on a form (#6743)
// An input loses its value after becoming a radio support.enctype = !!document.createElement( "form" ).enctype;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Support: IE8 only
// Check if we can trust getAttribute("value")
input = document.createElement( "input" ); input = document.createElement( "input" );
input.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
// Check if an input maintains its value after becoming a radio
input.value = "t"; input.value = "t";
input.type = "radio"; input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t"; support.radioValue = input.value === "t";
} )(); } )();
......
...@@ -16,7 +16,8 @@ jQuery.fn.extend( { ...@@ -16,7 +16,8 @@ jQuery.fn.extend( {
hooks = jQuery.valHooks[ elem.type ] || hooks = jQuery.valHooks[ elem.type ] ||
jQuery.valHooks[ elem.nodeName.toLowerCase() ]; jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && if (
hooks &&
"get" in hooks && "get" in hooks &&
( ret = hooks.get( elem, "value" ) ) !== undefined ( ret = hooks.get( elem, "value" ) ) !== undefined
) { ) {
...@@ -27,10 +28,10 @@ jQuery.fn.extend( { ...@@ -27,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;
} }
...@@ -55,10 +56,8 @@ jQuery.fn.extend( { ...@@ -55,10 +56,8 @@ jQuery.fn.extend( {
// Treat null/undefined as ""; convert numbers to string // Treat null/undefined as ""; convert numbers to string
if ( val == null ) { if ( val == null ) {
val = ""; val = "";
} else if ( typeof val === "number" ) { } else if ( typeof val === "number" ) {
val += ""; val += "";
} else if ( jQuery.isArray( val ) ) { } else if ( jQuery.isArray( val ) ) {
val = jQuery.map( val, function( value ) { val = jQuery.map( val, function( value ) {
return value == null ? "" : value + ""; return value == null ? "" : value + "";
...@@ -79,10 +78,13 @@ jQuery.extend( { ...@@ -79,10 +78,13 @@ jQuery.extend( {
valHooks: { valHooks: {
option: { option: {
get: function( elem ) { get: function( elem ) {
var val = jQuery.find.attr( elem, "value" );
return val != null ?
val :
// Support: IE<11 // Support: IE10-11+
// option.value not trimmed (#14858) // option.text throws exceptions (#14686, #14858)
return jQuery.trim( elem.value ); jQuery.trim( jQuery.text( elem ) );
} }
}, },
select: { select: {
...@@ -90,7 +92,7 @@ jQuery.extend( { ...@@ -90,7 +92,7 @@ jQuery.extend( {
var value, option, var value, option,
options = elem.options, options = elem.options,
index = elem.selectedIndex, index = elem.selectedIndex,
one = elem.type === "select-one", one = elem.type === "select-one" || index < 0,
values = one ? null : [], values = one ? null : [],
max = one ? index + 1 : options.length, max = one ? index + 1 : options.length,
i = index < 0 ? i = index < 0 ?
...@@ -101,11 +103,13 @@ jQuery.extend( { ...@@ -101,11 +103,13 @@ jQuery.extend( {
for ( ; i < max; i++ ) { for ( ; i < max; i++ ) {
option = options[ i ]; option = options[ i ];
// IE8-9 doesn't update selected after form reset (#2551) // oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) && if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup // Don't return options that are disabled or in a disabled optgroup
!option.disabled && ( support.optDisabled ?
!option.disabled :
option.getAttribute( "disabled" ) === null ) &&
( !option.parentNode.disabled || ( !option.parentNode.disabled ||
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
...@@ -133,10 +137,24 @@ jQuery.extend( { ...@@ -133,10 +137,24 @@ jQuery.extend( {
while ( i-- ) { while ( i-- ) {
option = options[ i ]; option = options[ i ];
if ( option.selected =
jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) {
) {
optionSet = true; // Support: IE6
// When new option element is added to select box we need to
// force reflow of newly added node in order to workaround delay
// of initialization properties
try {
option.selected = optionSet = true;
} catch ( _ ) {
// Will be executed only in IE6
option.scrollHeight;
}
} else {
option.selected = false;
} }
} }
...@@ -144,7 +162,8 @@ jQuery.extend( { ...@@ -144,7 +162,8 @@ jQuery.extend( {
if ( !optionSet ) { if ( !optionSet ) {
elem.selectedIndex = -1; elem.selectedIndex = -1;
} }
return values;
return options;
} }
} }
} }
......
...@@ -190,9 +190,9 @@ jQuery.Callbacks = function( options ) { ...@@ -190,9 +190,9 @@ jQuery.Callbacks = function( options ) {
// Also disable .add unless we have memory (since it would have no effect) // Also disable .add unless we have memory (since it would have no effect)
// Abort any pending executions // Abort any pending executions
lock: function() { lock: function() {
locked = queue = []; locked = true;
if ( !memory && !firing ) { if ( !memory ) {
list = memory = ""; self.disable();
} }
return this; return this;
}, },
......
define( [ define( [
"./var/arr", "./var/deletedIds",
"./var/document", "./var/document",
"./var/slice", "./var/slice",
"./var/concat", "./var/concat",
...@@ -8,10 +8,9 @@ define( [ ...@@ -8,10 +8,9 @@ define( [
"./var/class2type", "./var/class2type",
"./var/toString", "./var/toString",
"./var/hasOwn", "./var/hasOwn",
"./var/support", "./var/support"
"./core/DOMEval" ], function( deletedIds, document, slice, concat, push, indexOf,
], function( arr, document, slice, concat, class2type, toString, hasOwn, support ) {
push, indexOf, class2type, toString, hasOwn, support, DOMEval ) {
var var
version = "@VERSION", version = "@VERSION",
...@@ -24,13 +23,13 @@ var ...@@ -24,13 +23,13 @@ var
return new jQuery.fn.init( selector, context ); return new jQuery.fn.init( selector, context );
}, },
// Support: Android<4.1 // Support: Android<4.1, IE<9
// Make sure we trim BOM and NBSP // Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// Matches dashed string for camelizing // Matches dashed string for camelizing
rmsPrefix = /^-ms-/, rmsPrefix = /^-ms-/,
rdashAlpha = /-([a-z])/g, rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace() // Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) { fcamelCase = function( all, letter ) {
...@@ -44,6 +43,9 @@ jQuery.fn = jQuery.prototype = { ...@@ -44,6 +43,9 @@ jQuery.fn = jQuery.prototype = {
constructor: jQuery, constructor: jQuery,
// Start with an empty selector
selector: "",
// The default length of a jQuery object is 0 // The default length of a jQuery object is 0
length: 0, length: 0,
...@@ -72,6 +74,7 @@ jQuery.fn = jQuery.prototype = { ...@@ -72,6 +74,7 @@ jQuery.fn = jQuery.prototype = {
// Add the old object onto the stack (as a reference) // Add the old object onto the stack (as a reference)
ret.prevObject = this; ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set // Return the newly-formed element set
return ret; return ret;
...@@ -113,12 +116,12 @@ jQuery.fn = jQuery.prototype = { ...@@ -113,12 +116,12 @@ jQuery.fn = jQuery.prototype = {
// For internal use only. // For internal use only.
// Behaves like an Array's method, not like a jQuery method. // Behaves like an Array's method, not like a jQuery method.
push: push, push: push,
sort: arr.sort, sort: deletedIds.sort,
splice: arr.splice splice: deletedIds.splice
}; };
jQuery.extend = jQuery.fn.extend = function() { jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone, var src, copyIsArray, copy, name, options, clone,
target = arguments[ 0 ] || {}, target = arguments[ 0 ] || {},
i = 1, i = 1,
length = arguments.length, length = arguments.length,
...@@ -128,7 +131,7 @@ jQuery.extend = jQuery.fn.extend = function() { ...@@ -128,7 +131,7 @@ jQuery.extend = jQuery.fn.extend = function() {
if ( typeof target === "boolean" ) { if ( typeof target === "boolean" ) {
deep = target; deep = target;
// Skip the boolean and the target // skip the boolean and the target
target = arguments[ i ] || {}; target = arguments[ i ] || {};
i++; i++;
} }
...@@ -138,7 +141,7 @@ jQuery.extend = jQuery.fn.extend = function() { ...@@ -138,7 +141,7 @@ jQuery.extend = jQuery.fn.extend = function() {
target = {}; target = {};
} }
// Extend jQuery itself if only one argument is passed // extend jQuery itself if only one argument is passed
if ( i === length ) { if ( i === length ) {
target = this; target = this;
i--; i--;
...@@ -200,72 +203,103 @@ jQuery.extend( { ...@@ -200,72 +203,103 @@ jQuery.extend( {
noop: function() {}, noop: function() {},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) { isFunction: function( obj ) {
return jQuery.type( obj ) === "function"; return jQuery.type( obj ) === "function";
}, },
isArray: Array.isArray, isArray: Array.isArray || function( obj ) {
return jQuery.type( obj ) === "array";
},
isWindow: function( obj ) { isWindow: function( obj ) {
return obj != null && obj === obj.window; /* jshint eqeqeq: false */
return obj != null && obj == obj.window;
}, },
isNumeric: function( obj ) { isNumeric: function( obj ) {
// As of jQuery 3.0, isNumeric is limited to // parseFloat NaNs numeric-cast false positives (null|true|false|"")
// strings and numbers (primitives or objects) // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// that can be coerced to finite numbers (gh-2662) // subtraction forces infinities to NaN
var type = jQuery.type( obj ); // adding 1 corrects loss of precision from parseFloat (#15100)
return ( type === "number" || type === "string" ) && var realStringObj = obj && obj.toString();
( obj - parseFloat( obj ) + 1 ) >= 0; return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
}, },
isPlainObject: function( obj ) { isPlainObject: function( obj ) {
var key;
// Not plain objects: // Must be an Object.
// - Any object or value whose internal [[Class]] property is not "[object Object]" // Because of IE, we also have to check the presence of the constructor property.
// - DOM nodes // Make sure that DOM nodes and window objects don't pass through, as well
// - window if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false; return false;
} }
if ( obj.constructor && try {
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call( obj, "constructor" ) &&
!hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false; return false;
} }
// If the function hasn't returned already, we're confident that // Support: IE<9
// |obj| is a plain object, created by {} or constructed with new Object // Handle iteration over inherited properties before own properties.
return true; if ( !support.ownFirst ) {
}, for ( key in obj ) {
return hasOwn.call( obj, key );
isEmptyObject: function( obj ) { }
var name;
for ( name in obj ) {
return false;
} }
return true;
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
}, },
type: function( obj ) { type: function( obj ) {
if ( obj == null ) { if ( obj == null ) {
return obj + ""; return obj + "";
} }
// Support: Android<4.0 (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ? return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" : class2type[ toString.call( obj ) ] || "object" :
typeof obj; typeof obj;
}, },
// Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll
globalEval: function( code ) { // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
DOMEval( code ); globalEval: function( data ) {
if ( data && jQuery.trim( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation
} )( data );
}
}, },
// 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 );
...@@ -296,7 +330,7 @@ jQuery.extend( { ...@@ -296,7 +330,7 @@ jQuery.extend( {
return obj; return obj;
}, },
// Support: Android<4.1 // Support: Android<4.1, IE<9
trim: function( text ) { trim: function( text ) {
return text == null ? return text == null ?
"" : "" :
...@@ -322,18 +356,43 @@ jQuery.extend( { ...@@ -322,18 +356,43 @@ jQuery.extend( {
}, },
inArray: function( elem, arr, i ) { inArray: function( elem, arr, i ) {
return arr == null ? -1 : indexOf.call( arr, elem, i ); var len;
if ( arr ) {
if ( indexOf ) {
return indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
}, },
// Support: Android<4.1, PhantomJS<2
// push.apply(_, arraylike) throws on ancient WebKit
merge: function( first, second ) { merge: function( first, second ) {
var len = +second.length, var len = +second.length,
j = 0, j = 0,
i = first.length; i = first.length;
for ( ; j < len; j++ ) { while ( j < len ) {
first[ i++ ] = second[ j ]; first[ i++ ] = second[ j++ ];
}
// Support: IE<9
// Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
if ( len !== len ) {
while ( second[ j ] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
} }
first.length = i; first.length = i;
...@@ -398,7 +457,7 @@ jQuery.extend( { ...@@ -398,7 +457,7 @@ jQuery.extend( {
// Bind a function to a context, optionally partially applying any // Bind a function to a context, optionally partially applying any
// arguments. // arguments.
proxy: function( fn, context ) { proxy: function( fn, context ) {
var tmp, args, proxy; var args, proxy, tmp;
if ( typeof context === "string" ) { if ( typeof context === "string" ) {
tmp = fn[ context ]; tmp = fn[ context ];
...@@ -424,7 +483,9 @@ jQuery.extend( { ...@@ -424,7 +483,9 @@ jQuery.extend( {
return proxy; return proxy;
}, },
now: Date.now, now: function() {
return +( new Date() );
},
// jQuery.support is not used in Core but other projects attach their // jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist. // properties to it so it needs to exist.
...@@ -437,7 +498,7 @@ jQuery.extend( { ...@@ -437,7 +498,7 @@ jQuery.extend( {
// three lines. // three lines.
/* jshint ignore: start */ /* jshint ignore: start */
if ( typeof Symbol === "function" ) { if ( typeof Symbol === "function" ) {
jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
} }
/* jshint ignore: end */ /* jshint ignore: end */
......
...@@ -6,7 +6,7 @@ define( [ ...@@ -6,7 +6,7 @@ define( [
// The value/s can optionally be executed if it's a function // The value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0, var i = 0,
len = elems.length, length = elems.length,
bulk = key == null; bulk = key == null;
// Sets many values // Sets many values
...@@ -41,11 +41,11 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { ...@@ -41,11 +41,11 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
} }
if ( fn ) { if ( fn ) {
for ( ; i < len; i++ ) { for ( ; i < length; i++ ) {
fn( fn(
elems[ i ], key, raw ? elems[ i ],
value : key,
value.call( elems[ i ], i, fn( elems[ i ], key ) ) raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) )
); );
} }
} }
...@@ -57,7 +57,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { ...@@ -57,7 +57,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
// Gets // Gets
bulk ? bulk ?
fn.call( elems ) : fn.call( elems ) :
len ? fn( elems[ 0 ], key ) : emptyGet; length ? fn( elems[ 0 ], key ) : emptyGet;
}; };
return access; return access;
......
...@@ -12,8 +12,7 @@ var rootjQuery, ...@@ -12,8 +12,7 @@ var rootjQuery,
// A simple way to check for HTML strings // A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521) // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <) // Strict HTML recognition (#11290: must start with <)
// Shortcut simple #id case for speed rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
init = jQuery.fn.init = function( selector, context, root ) { init = jQuery.fn.init = function( selector, context, root ) {
var match, elem; var match, elem;
...@@ -23,14 +22,14 @@ var rootjQuery, ...@@ -23,14 +22,14 @@ var rootjQuery,
return this; return this;
} }
// Method init() accepts an alternate rootjQuery // init accepts an alternate rootjQuery
// so migrate can support jQuery.sub (gh-2101) // so migrate can support jQuery.sub (gh-2101)
root = root || rootjQuery; root = root || rootjQuery;
// Handle HTML strings // Handle HTML strings
if ( typeof selector === "string" ) { if ( typeof selector === "string" ) {
if ( selector[ 0 ] === "<" && if ( selector.charAt( 0 ) === "<" &&
selector[ selector.length - 1 ] === ">" && selector.charAt( selector.length - 1 ) === ">" &&
selector.length >= 3 ) { selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check // Assume that strings that start and end with <> are HTML and skip the regex check
...@@ -47,7 +46,7 @@ var rootjQuery, ...@@ -47,7 +46,7 @@ var rootjQuery,
if ( match[ 1 ] ) { if ( match[ 1 ] ) {
context = context instanceof jQuery ? context[ 0 ] : context; context = context instanceof jQuery ? context[ 0 ] : context;
// Option to run scripts is true for back-compat // scripts is true for back-compat
// Intentionally let the error be thrown if parseHTML is not present // Intentionally let the error be thrown if parseHTML is not present
jQuery.merge( this, jQuery.parseHTML( jQuery.merge( this, jQuery.parseHTML(
match[ 1 ], match[ 1 ],
...@@ -76,12 +75,23 @@ var rootjQuery, ...@@ -76,12 +75,23 @@ var rootjQuery,
} else { } else {
elem = document.getElementById( match[ 2 ] ); elem = document.getElementById( match[ 2 ] );
if ( elem ) { // Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Inject the element directly into the jQuery object // Handle the case where IE and Opera return items
this[ 0 ] = elem; // 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.context = document;
this.selector = selector;
return this; return this;
} }
...@@ -97,20 +107,25 @@ var rootjQuery, ...@@ -97,20 +107,25 @@ var rootjQuery,
// HANDLE: $(DOMElement) // HANDLE: $(DOMElement)
} else if ( selector.nodeType ) { } else if ( selector.nodeType ) {
this[ 0 ] = selector; this.context = this[ 0 ] = selector;
this.length = 1; this.length = 1;
return this; return this;
// HANDLE: $(function) // HANDLE: $(function)
// Shortcut for document ready // Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) { } else if ( jQuery.isFunction( selector ) ) {
return root.ready !== undefined ? return typeof root.ready !== "undefined" ?
root.ready( selector ) : root.ready( selector ) :
// Execute immediately if ready is not present // Execute immediately if ready is not present
selector( jQuery ); selector( jQuery );
} }
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this ); return jQuery.makeArray( selector, this );
}; };
......
...@@ -8,21 +8,21 @@ define( [ ...@@ -8,21 +8,21 @@ define( [
"./support" "./support"
], function( jQuery, document, rsingleTag, buildFragment, support ) { ], function( jQuery, document, rsingleTag, buildFragment, support ) {
// Argument "data" should be string of html // data: 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
jQuery.parseHTML = function( data, context, keepScripts ) { jQuery.parseHTML = function( data, context, keepScripts ) {
if ( typeof data !== "string" ) { if ( !data || typeof data !== "string" ) {
return []; return null;
} }
if ( typeof context === "boolean" ) { if ( typeof context === "boolean" ) {
keepScripts = context; keepScripts = context;
context = false; context = false;
} }
// Stop scripts or inline event handlers from being executed immediately // document.implementation stops scripts or inline event handlers from
// by using document.implementation // being executed immediately
context = context || ( support.createHTMLDocument ? context = context || ( support.createHTMLDocument ?
document.implementation.createHTMLDocument( "" ) : document.implementation.createHTMLDocument( "" ) :
document ); document );
......
define( [ define( [
"../core", "../core",
"../var/document", "../var/document",
"../core/init",
"../deferred" "../deferred"
], function( jQuery, document ) { ], function( jQuery, document ) {
...@@ -51,16 +52,42 @@ jQuery.extend( { ...@@ -51,16 +52,42 @@ jQuery.extend( {
// If there are functions bound, to execute // If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] ); readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.triggerHandler ) {
jQuery( document ).triggerHandler( "ready" );
jQuery( document ).off( "ready" );
}
} }
} ); } );
/**
* Clean-up method for dom ready events
*/
function detach() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed );
window.removeEventListener( "load", completed );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
}
/** /**
* The ready event handler and self cleanup method * The ready event handler and self cleanup method
*/ */
function completed() { function completed() {
document.removeEventListener( "DOMContentLoaded", completed );
window.removeEventListener( "load", completed ); // readyState === "complete" is good enough for us to call the dom ready in oldIE
jQuery.ready(); if ( document.addEventListener ||
window.event.type === "load" ||
document.readyState === "complete" ) {
detach();
jQuery.ready();
}
} }
jQuery.ready.promise = function( obj ) { jQuery.ready.promise = function( obj ) {
...@@ -70,7 +97,7 @@ jQuery.ready.promise = function( obj ) { ...@@ -70,7 +97,7 @@ jQuery.ready.promise = function( obj ) {
// Catch cases where $(document).ready() is called // Catch cases where $(document).ready() is called
// after the browser event has already occurred. // after the browser event has already occurred.
// Support: IE9-10 only // Support: IE6-10
// Older IE sometimes signals "interactive" too soon // Older IE sometimes signals "interactive" too soon
if ( document.readyState === "complete" || if ( document.readyState === "complete" ||
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
...@@ -78,13 +105,53 @@ jQuery.ready.promise = function( obj ) { ...@@ -78,13 +105,53 @@ jQuery.ready.promise = function( obj ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready // Handle it asynchronously to allow scripts the opportunity to delay ready
window.setTimeout( jQuery.ready ); window.setTimeout( jQuery.ready );
} else { // Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback // Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed ); document.addEventListener( "DOMContentLoaded", completed );
// A fallback to window.onload, that will always work // A fallback to window.onload, that will always work
window.addEventListener( "load", completed ); window.addEventListener( "load", completed );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", completed );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch ( e ) {}
if ( top && top.doScroll ) {
( function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll( "left" );
} catch ( e ) {
return window.setTimeout( doScrollCheck, 50 );
}
// detach all dom ready events
detach();
// and execute any waiting functions
jQuery.ready();
}
} )();
}
} }
} }
return readyList.promise( obj ); return readyList.promise( obj );
......
...@@ -9,9 +9,12 @@ define( [ ...@@ -9,9 +9,12 @@ define( [
// Because of that, this security measure has to be disabled in Safari 8. // Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337 // https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = ( function() { support.createHTMLDocument = ( function() {
var body = document.implementation.createHTMLDocument( "" ).body; if ( !document.implementation.createHTMLDocument ) {
body.innerHTML = "<form></form><form></form>"; return false;
return body.childNodes.length === 2; }
var doc = document.implementation.createHTMLDocument( "" );
doc.body.innerHTML = "<form></form><form></form>";
return doc.body.childNodes.length === 2;
} )(); } )();
return support; return support;
......
define( function() { define( function() {
// Match a standalone tag // Match a standalone tag
return ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); return ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
} ); } );
This diff is collapsed.
define( [ define( [
"exports",
"../core", "../core",
"../var/documentElement",
"./var/rnumnonpx", "./var/rnumnonpx",
"./var/rmargin", "./var/rmargin",
"./var/getStyles",
"./support", "./support",
"../selector" // Get jQuery.contains "../selector" // contains
], function( jQuery, rnumnonpx, rmargin, getStyles, support ) { ], function( exports, jQuery, documentElement, rnumnonpx, rmargin, support ) {
function curCSS( elem, name, computed ) { var getStyles, curCSS,
var width, minWidth, maxWidth, ret, rposition = /^(top|right|bottom|left)$/;
style = elem.style;
computed = computed || getStyles( elem ); if ( window.getComputedStyle ) {
getStyles = function( elem ) {
// Support: IE9 // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
// getPropertyValue is only needed for .css('filter') (#12537) // IE throws on elements created in popups
if ( computed ) { // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
ret = computed.getPropertyValue( name ) || computed[ name ]; var view = elem.ownerDocument.defaultView;
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { if ( !view || !view.opener ) {
view = window;
}
return view.getComputedStyle( elem );
};
curCSS = function( elem, name, computed ) {
var width, minWidth, maxWidth, ret,
style = elem.style;
computed = computed || getStyles( elem );
// 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 ); ret = jQuery.style( elem, name );
} }
// A tribute to the "awesome hack by Dean Edwards" if ( computed ) {
// Android Browser returns percentage for some values,
// but width seems to be reliably pixels. // A tribute to the "awesome hack by Dean Edwards"
// This is against the CSSOM draft spec: // Chrome < 17 and Safari 5.0 uses "computed value"
// http://dev.w3.org/csswg/cssom/#resolved-values // instead of "used value" for margin-right
if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { // Safari 5.1.7 (at least) returns percentage for a larger set of values,
// but width seems to be reliably pixels
// this is against the CSSOM draft spec:
// http://dev.w3.org/csswg/cssom/#resolved-values
if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
// Support: IE
// IE returns zIndex value as an integer.
return ret === undefined ?
ret :
ret + "";
};
} else if ( documentElement.currentStyle ) {
getStyles = function( elem ) {
return elem.currentStyle;
};
curCSS = function( elem, name, computed ) {
var left, rs, rsLeft, ret,
style = elem.style;
computed = computed || getStyles( elem );
ret = computed ? computed[ name ] : undefined;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are
// proportional to the parent element instead
// and we can't measure the parent instead because it
// might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values // Remember the original values
width = style.width; left = style.left;
minWidth = style.minWidth; rs = elem.runtimeStyle;
maxWidth = style.maxWidth; rsLeft = rs && rs.left;
// Put in the new values to get a computed value out // Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret; if ( rsLeft ) {
ret = computed.width; rs.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values // Revert the changed values
style.width = width; style.left = left;
style.minWidth = minWidth; if ( rsLeft ) {
style.maxWidth = maxWidth; rs.left = rsLeft;
}
} }
}
return ret !== undefined ? // Support: IE
// Support: IE9-11+
// IE returns zIndex value as an integer. // IE returns zIndex value as an integer.
ret + "" : return ret === undefined ?
ret; ret :
ret + "" || "auto";
};
} }
return curCSS; exports.getStyles = getStyles;
exports.curCSS = curCSS;
} ); } );
...@@ -51,7 +51,7 @@ function defaultDisplay( nodeName ) { ...@@ -51,7 +51,7 @@ function defaultDisplay( nodeName ) {
.appendTo( doc.documentElement ); .appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = iframe[ 0 ].contentDocument; doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
// Support: IE // Support: IE
doc.write(); doc.write();
......
define( [ define( [
"../core", "../core",
"../selector" "./support",
], function( jQuery ) { "../selector",
"../css"
], function( jQuery, support ) {
function getDisplay( elem ) {
return elem.style && elem.style.display || jQuery.css( elem, "display" );
}
function filterHidden( elem ) {
while ( elem && elem.nodeType === 1 ) {
if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) {
return true;
}
elem = elem.parentNode;
}
return false;
}
jQuery.expr.filters.hidden = function( elem ) { jQuery.expr.filters.hidden = function( elem ) {
return !jQuery.expr.filters.visible( elem );
// Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements
return support.reliableHiddenOffsets() ?
( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 &&
!elem.getClientRects().length ) :
filterHidden( elem );
}; };
jQuery.expr.filters.visible = function( elem ) { jQuery.expr.filters.visible = function( elem ) {
return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); return !jQuery.expr.filters.hidden( elem );
}; };
} ); } );
define( [ define( [], function() {
"../core",
"../data/var/dataPriv",
"../css/var/isHidden"
], function( jQuery, dataPriv, isHidden ) {
var defaultDisplayMap = {};
function getDefaultDisplay( elem ) {
var temp,
doc = elem.ownerDocument,
nodeName = elem.nodeName,
display = defaultDisplayMap[ nodeName ];
if ( display ) {
return display;
}
temp = doc.body.appendChild( doc.createElement( nodeName ) ),
display = jQuery.css( temp, "display" );
temp.parentNode.removeChild( temp );
if ( display === "none" ) {
display = "block";
}
defaultDisplayMap[ nodeName ] = display;
return display;
}
function showHide( elements, show ) { function showHide( elements, show ) {
var display, elem, var display, elem,
values = [], values = [],
...@@ -44,35 +14,23 @@ function showHide( elements, show ) { ...@@ -44,35 +14,23 @@ function showHide( elements, show ) {
display = elem.style.display; display = elem.style.display;
if ( show ) { if ( show ) {
// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
// check is required in this first loop unless we have a nonempty display value (either
// inline or about-to-be-restored)
if ( display === "none" ) { if ( display === "none" ) {
values[ index ] = dataPriv.get( elem, "display" ) || null;
if ( !values[ index ] ) {
elem.style.display = "";
}
}
if ( elem.style.display === "" && jQuery.css( elem, "display" ) === "none" &&
// Support: Firefox <=42 - 43
// Don't set inline display on disconnected elements with computed display: none
jQuery.contains( elem.ownerDocument, elem ) ) {
values[ index ] = getDefaultDisplay( elem ); // Restore a pre-hide() value if we have one
values[ index ] = jQuery._data( elem, "display" ) || "";
} }
} else { } else {
if ( display !== "none" ) { if ( display !== "none" ) {
values[ index ] = "none"; values[ index ] = "none";
// Remember what we're overwriting // Remember the value we're replacing
dataPriv.set( elem, "display", display ); jQuery._data( elem, "display", display );
} }
} }
} }
// Set the display of the elements in a second loop to avoid constant reflow // Set the display of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) { for ( index = 0; index < length; index++ ) {
if ( values[ index ] != null ) { if ( values[ index ] != null ) {
elements[ index ].style.display = values[ index ]; elements[ index ].style.display = values[ index ];
...@@ -82,27 +40,6 @@ function showHide( elements, show ) { ...@@ -82,27 +40,6 @@ function showHide( elements, show ) {
return elements; return elements;
} }
jQuery.fn.extend( {
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state ) {
if ( typeof state === "boolean" ) {
return state ? this.show() : this.hide();
}
return this.each( function() {
if ( isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
} );
}
} );
return showHide; return showHide;
} ); } );
...@@ -6,7 +6,8 @@ define( [ ...@@ -6,7 +6,8 @@ define( [
], function( jQuery, document, documentElement, support ) { ], function( jQuery, document, documentElement, support ) {
( function() { ( function() {
var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal,
reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal,
container = document.createElement( "div" ), container = document.createElement( "div" ),
div = document.createElement( "div" ); div = document.createElement( "div" );
...@@ -15,74 +16,166 @@ define( [ ...@@ -15,74 +16,166 @@ define( [
return; return;
} }
// Support: IE9-11+ div.style.cssText = "float:left;opacity:.5";
// 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 );
// Executing both pixelPosition & boxSizingReliable tests require only one layout // Support: Firefox<29, Android 2.3
// so they're executed at the same time to save the second computation. // Vendor-prefix box-sizing
function computeStyleTests() { support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" ||
div.style.cssText = div.style.WebkitBoxSizing === "";
"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, {
pixelPosition: function() { reliableHiddenOffsets: function() {
if ( pixelPositionVal == null ) {
// This test is executed only once but we still do memoizing computeStyleTests();
// since we can use the boxSizingReliable pre-computing. }
// No need to check if the test was already performed, though. return reliableHiddenOffsetsVal;
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
// We're checking for boxSizingReliableVal here instead of pixelMarginRightVal if ( pixelPositionVal == null ) {
// 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 ( boxSizingReliableVal == null ) { if ( pixelPositionVal == null ) {
computeStyleTests(); computeStyleTests();
} }
return reliableMarginLeftVal; return reliableMarginLeftVal;
} }
} ); } );
function computeStyleTests() {
var contents, divStyle,
documentElement = document.documentElement;
// Setup
documentElement.appendChild( container );
div.style.cssText =
// Support: Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:border-box;box-sizing:border-box;" +
"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
contents = div.appendChild( document.createElement( "div" ) );
// Reset CSS: box-sizing; display; margin; border; padding
contents.style.cssText = div.style.cssText =
// Support: Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
contents.style.marginRight = contents.style.width = "0";
div.style.width = "1px";
reliableMarginRightVal =
!parseFloat( ( window.getComputedStyle( contents ) || {} ).marginRight );
div.removeChild( contents );
}
// Support: IE6-8
// 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;
......
This diff is collapsed.
define( function() { define( [
"../../core"
], function( jQuery ) {
/** /**
* Determines whether an object can have data * Determines whether an object can have data
*/ */
return function( owner ) { return function( elem ) {
var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ],
nodeType = +elem.nodeType || 1;
// Accepts only: // Do not set data on non-element DOM nodes because it will not be cleared (#8335).
// - Node return nodeType !== 1 && nodeType !== 9 ?
// - Node.ELEMENT_NODE false :
// - Node.DOCUMENT_NODE
// - Object // Nodes accept data unless otherwise specified; rejection can be conditional
// - Any !noData || noData !== true && elem.getAttribute( "classid" ) === noData;
/* jshint -W018 */
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
}; };
} ); } );
This diff is collapsed.
define( [ define( [
"./core" "./core",
"./traversing"
], function( jQuery ) { ], function( jQuery ) {
jQuery.fn.extend( { jQuery.fn.extend( {
...@@ -23,4 +24,11 @@ jQuery.fn.extend( { ...@@ -23,4 +24,11 @@ jQuery.fn.extend( {
} }
} ); } );
// The number of elements contained in the matched element set
jQuery.fn.size = function() {
return this.length;
};
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" );
...@@ -19,10 +19,10 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { ...@@ -19,10 +19,10 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
if ( jQuery.isWindow( elem ) ) { if ( jQuery.isWindow( elem ) ) {
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
return funcName.indexOf( "outer" ) === 0 ? // isn't a whole lot we can do. See pull request at this URL for discussion:
elem[ "inner" + name ] : // https://github.com/jquery/jquery/pull/764
elem.document.documentElement[ "client" + name ]; return elem.document.documentElement[ "client" + name ];
} }
// Get document width or height // Get document width or height
...@@ -31,6 +31,8 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { ...@@ -31,6 +31,8 @@ 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 ],
...@@ -45,7 +47,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { ...@@ -45,7 +47,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// Set width or height on the element // Set width or height on the element
jQuery.style( elem, type, value, extra ); jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable ); }, type, chainable ? margin : undefined, chainable, null );
}; };
} ); } );
} ); } );
......
This diff is collapsed.
...@@ -27,12 +27,17 @@ Tween.prototype = { ...@@ -27,12 +27,17 @@ Tween.prototype = {
Tween.propHooks._default.get( this ); Tween.propHooks._default.get( this );
}, },
run: function( percent ) { run: function( percent ) {
var hooks = Tween.propHooks[ this.prop ]; var eased,
hooks = Tween.propHooks[ this.prop ];
this.pos = this.options.duration ? if ( this.options.duration ) {
jQuery.easing[ this.easing ]( percent ) : this.pos = eased = jQuery.easing[ this.easing ](
percent; percent, this.options.duration * percent, 0, 1, this.options.duration
this.now = ( this.end - this.start ) * this.pos + this.start; );
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) { if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this ); this.options.step.call( this.elem, this.now, this );
...@@ -61,10 +66,10 @@ Tween.propHooks = { ...@@ -61,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
// Simple values such as "10px" are parsed to Float; // so, 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.
...@@ -72,9 +77,8 @@ Tween.propHooks = { ...@@ -72,9 +77,8 @@ Tween.propHooks = {
}, },
set: function( tween ) { set: function( tween ) {
// Use step hook for back compat. // use step hook for back compat - use cssHook if its there - use .style if its
// Use cssHook if its there. // available and use plain properties where available
// 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 &&
...@@ -88,8 +92,9 @@ Tween.propHooks = { ...@@ -88,8 +92,9 @@ Tween.propHooks = {
} }
}; };
// Support: IE9 // Support: IE <=9
// 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 ) {
......
This diff is collapsed.
define( [ define( [
"../core", "../core",
"../event"
"../event",
"./trigger"
], function( jQuery ) { ], function( jQuery ) {
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ), "change select submit keydown keypress keyup error contextmenu" ).split( " " ),
function( i, name ) { function( i, name ) {
// Handle event binding // Handle event binding
......
define( [ define( [
"../var/document",
"../var/support" "../var/support"
], function( support ) { ], function( document, support ) {
support.focusin = "onfocusin" in window; ( function() {
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 AMD // Expose jQuery and $ identifiers, even in
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) // AMD (#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;
......
/*! /*!
* jQuery JavaScript Library v@VERSION * jQuery JavaScript Library v@VERSION
* https://jquery.com/ * http://jquery.com/
* *
* Includes Sizzle.js * Includes Sizzle.js
* https://sizzlejs.com/ * http://sizzlejs.com/
* *
* Copyright jQuery Foundation and other contributors * Copyright jQuery Foundation and other contributors
* Released under the MIT license * Released under the MIT license
* https://jquery.org/license * http://jquery.org/license
* *
* Date: @DATE * Date: @DATE
*/ */
......
...@@ -4,15 +4,14 @@ define( [ ...@@ -4,15 +4,14 @@ define( [
"./traversing", "./traversing",
"./callbacks", "./callbacks",
"./deferred", "./deferred",
"./deferred/exceptionHook",
"./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",
......
This diff is collapsed.
define( [ define( [
"../core", "../core",
"./var/rcheckableType",
"./var/rtagName", "./var/rtagName",
"./var/rscriptType", "./var/rscriptType",
"./var/rleadingWhitespace",
"./createSafeFragment",
"./wrapMap", "./wrapMap",
"./getAll", "./getAll",
"./setGlobalEval" "./setGlobalEval",
], function( jQuery, rtagName, rscriptType, wrapMap, getAll, setGlobalEval ) { "./support"
], 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 elem, tmp, tag, wrap, contains, j, var j, elem, contains,
fragment = context.createDocumentFragment(), tmp, tag, tbody, wrap,
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 ];
...@@ -23,9 +39,6 @@ function buildFragment( elems, context, scripts, selection, ignored ) { ...@@ -23,9 +39,6 @@ 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
...@@ -34,11 +47,12 @@ function buildFragment( elems, context, scripts, selection, ignored ) { ...@@ -34,11 +47,12 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
// Convert html into DOM nodes // Convert html into DOM nodes
} else { } else {
tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); tmp = tmp || safe.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
...@@ -47,21 +61,59 @@ function buildFragment( elems, context, scripts, selection, ignored ) { ...@@ -47,21 +61,59 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
tmp = tmp.lastChild; tmp = tmp.lastChild;
} }
// Support: Android<4.1, PhantomJS<2 // Manually add leading whitespace removed by IE
// push.apply(_, arraylike) throws on ancient WebKit if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
jQuery.merge( nodes, tmp.childNodes ); 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;
// Remember the top-level container j = elem && elem.childNodes.length;
tmp = fragment.firstChild; while ( j-- ) {
if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) &&
!tbody.childNodes.length ) {
// Ensure the created nodes are orphaned (#12392) elem.removeChild( tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
tmp.textContent = ""; tmp.textContent = "";
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild );
}
// Remember the top-level container for proper cleanup
tmp = safe.lastChild;
} }
} }
} }
// Remove wrapper from fragment // Fix #11356: Clear elements from fragment
fragment.textContent = ""; if ( tmp ) {
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++ ] ) ) {
...@@ -71,13 +123,14 @@ function buildFragment( elems, context, scripts, selection, ignored ) { ...@@ -71,13 +123,14 @@ 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( fragment.appendChild( elem ), "script" ); tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history // Preserve script evaluation history
if ( contains ) { if ( contains ) {
...@@ -95,7 +148,9 @@ function buildFragment( elems, context, scripts, selection, ignored ) { ...@@ -95,7 +148,9 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
} }
} }
return fragment; tmp = null;
return safe;
} }
return buildFragment; return buildFragment;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
define( function() { define( function() {
return ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); return ( /<([\w:-]+)/ );
} ); } );
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment