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>
Stefan Petre <stefan.petre@gmail.com>
Yehuda Katz <wycats@gmail.com>
Corey Jewett <cj@syntheticplayground.com>
Klaus Hartl <klaus.hartl@gmail.com>
Klaus Hartl <klaus.hartl@googlemail.com>
Franck Marcia <franck.marcia@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>
Mike Alsup <malsup@gmail.com>
Dave Methvin <dave.methvin@gmail.com>
......@@ -47,7 +47,7 @@ Matt Curry <matt@pseudocoder.com>
Michael Monteleone <michael@michaelmonteleone.net>
Noah Sloan <noah.sloan@gmail.com>
Tom Viner <github@viner.tv>
Douglas Neiner <doug@dougneiner.com>
Douglas Neiner <doug@pixelgraphics.us>
Adam J. Sontag <ajpiano@ajpiano.com>
Dave Reed <dareed@microsoft.com>
Ralph Whitbeck <ralph.whitbeck@gmail.com>
......@@ -57,7 +57,7 @@ J. Ryan Stinnett <jryans@gmail.com>
unknown <Igen005@.upcorp.ad.uprr.com>
temp01 <temp01irc@gmail.com>
Heungsub Lee <h@subl.ee>
Colin Snover <github.com@zetafleet.com>
Colin Snover <colin@alpha.zetafleet.com>
Ryan W Tenney <ryan@10e.us>
Pinhook <contact@pinhooklabs.com>
Ron Otten <r.j.g.otten@gmail.com>
......@@ -69,7 +69,7 @@ Henri Wiechers <hwiechers@gmail.com>
Russell Holbrook <russell.holbrook@patch.com>
Julian Aubourg <aubourg.julian@gmail.com>
Gianni Alessandro Chiappetta <gianni@runlevel6.org>
Scott Jehl <scottjehl@gmail.com>
Scott Jehl <scott@scottjehl.com>
James Burke <jrburke@gmail.com>
Jonas Pfenniger <jonas@pfenniger.name>
Xavi Ramirez <xavi.rmz@gmail.com>
......@@ -78,10 +78,10 @@ Sylvester Keil <sylvester@keil.or.at>
Brandon Sterne <bsterne@mozilla.com>
Mathias Bynens <mathias@qiwi.be>
Timmy Willison <timmywillisn@gmail.com>
Corey Frang <gnarf37@gmail.com>
Corey Frang <gnarf@gnarf.net>
Digitalxero <digitalxero>
Anton Kovalyov <anton@kovalyov.net>
David Murdoch <david@davidmurdoch.com>
David Murdoch <musicisair@yahoo.com>
Josh Varner <josh.varner@gmail.com>
Charles McNulty <cmcnulty@kznf.com>
Jordan Boesch <jboesch26@gmail.com>
......@@ -139,7 +139,7 @@ Chris Faulkner <thefaulkner@gmail.com>
Elijah Manor <elijah.manor@gmail.com>
Daniel Chatfield <chatfielddaniel@gmail.com>
Nikita Govorov <nikita.govorov@gmail.com>
Wesley Walser <waw325@gmail.com>
Wesley Walser <wwalser@atlassian.com>
Mike Pennisi <mike@mikepennisi.com>
Markus Staab <markus.staab@redaxo.de>
Dave Riddle <david@joyvuu.com>
......@@ -170,8 +170,6 @@ Paul Ramos <paul.b.ramos@gmail.com>
Rod Vagg <rod@vagg.org>
Bennett Sorbo <bsorbo@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>
Danil Somsikov <danilasomsikov@gmail.com>
Ryunosuke SATO <tricknotes.rs@gmail.com>
......@@ -179,70 +177,62 @@ Jean Boussier <jean.boussier@gmail.com>
Adam Coulombe <me@adam.co>
Andrew Plummer <plummer.andrew@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>
Michał Gołębiowski <m.goleb@gmail.com>
Li Xudong <istonelee@gmail.com>
Steven Benner <admin@stevenbenner.com>
Nguyen Phuc Lam <ruado1987@gmail.com>
Tom H Fuertes <tomfuertes@gmail.com>
Renato Oliveira dos Santos <ros3@cin.ufpe.br>
ros3cin <ros3@cin.ufpe.br>
Brandon Johnson <bjohn465+github@gmail.com>
Jason Bedard <jason+jquery@jbedard.ca>
Kyle Robinson Young <kyle@dontkry.com>
Renato Oliveira dos Santos <ros3@cin.ufpe.br>
Chris Talkington <chris@talkingtontech.com>
Eddie Monge <eddie@eddiemonge.com>
Terry Jones <terry@jon.es>
Jason Merino <jasonmerino@gmail.com>
Jeremy Dunck <jdunck@gmail.com>
Chris Price <price.c@gmail.com>
Guy Bedford <guybedford@gmail.com>
Amey Sakhadeo <me@ameyms.com>
Mike Sidorov <mikes.ekb@gmail.com>
Anthony Ryan <anthonyryan1@gmail.com>
Dominik D. Geyer <dominik.geyer@gmail.com>
George Kats <katsgeorgeek@gmail.com>
Lihan Li <frankieteardrop@gmail.com>
Ronny Springer <springer.ronny@gmail.com>
Chris Antaki <ChrisAntaki@gmail.com>
Marian Sollmann <marian.sollmann@cargomedia.ch>
njhamann <njhamann@gmail.com>
Ilya Kantor <iliakan@gmail.com>
Corey Frang <gnarf37@gmail.com>
Chris Antaki <ChrisAntaki@gmail.com>
Noah Hamann <njhamann@gmail.com>
David Hong <d.hong@me.com>
John Paul <john@johnkpaul.com>
Jakob Stoeck <jakob@pokermania.de>
Christopher Jones <chris@cjqed.com>
Christopher Jones <christopherjonesqed@gmail.com>
Forbes Lindesay <forbes@lindesay.co.uk>
John Paul <john@johnkpaul.com>
S. Andrew Sheppard <andrew@wq.io>
Leonardo Balter <leonardo.balter@gmail.com>
Roman Reiß <me@silverwind.io>
Benjy Cui <benjytrys@gmail.com>
Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
John Hoven <hovenj@gmail.com>
Philip Jägenstedt <philip@foolip.org>
Christian Kosmowski <ksmwsk@gmail.com>
Liang Peng <poppinlp@gmail.com>
TJ VanToll <tj.vantoll@gmail.com>
Senya Pugach <upisfree@outlook.com>
Aurelio De Rosa <aurelioderosa@gmail.com>
Nazar Mokrynskyi <nazar@mokrynskyi.com>
Amit Merchant <bullredeyes@gmail.com>
Jason Bedard <jason+github@jbedard.ca>
Arthur Verschaeve <contact@arthurverschaeve.be>
Dan Hart <danhart@notonthehighstreet.com>
Scott González <scott.gonzalez@gmail.com>
Zheming Sun <mescodasun@gmail.com>
Bin Xin <rhyzix@gmail.com>
David Corbacho <davidcorbacho@gmail.com>
Veaceslav Grimalschi <grimalschi@yandex.ru>
Daniel Husar <dano.husar@gmail.com>
Frederic Hemberger <mail@frederic-hemberger.de>
Jason Bedard <jason+github@jbedard.ca>
Ben Toews <mastahyeti@gmail.com>
Aditya Raghavan <araghavan3@gmail.com>
Victor Homyakov <vkhomyackov@gmail.com>
Shivaji Varma <contact@shivajivarma.com>
Nicolas HENRY <icewil@gmail.com>
Norman Xu <homyu.shinn@gmail.com>
Anne-Gaelle Colom <coloma@westminster.ac.uk>
Victor Homyakov <vkhomyackov@gmail.com>
George Mauer <gmauer@gmail.com>
Leonardo Braga <leonardo.braga@gmail.com>
Stephen Edgar <stephen@netweb.com.au>
......@@ -256,25 +246,21 @@ Calvin Metcalf <calvin.metcalf@gmail.com>
Mu Haibao <mhbseal@163.com>
Richard McDaniel <rm0026@uah.edu>
Chris Rebert <github@rebertia.com>
Gabriel Schulhof <gabriel.schulhof@intel.com>
Gilad Peleg <giladp007@gmail.com>
Martin Naumann <martin@geekonaut.de>
Marek Lewandowski <m.lewandowski@cksource.com>
Bruno Pérel <brunoperel@gmail.com>
Reed Loden <reed@reedloden.com>
Daniel Nill <daniellnill@gmail.com>
Yongwoo Jeon <yongwoo.jeon@navercorp.com>
Sean Henderson <seanh.za@gmail.com>
Adrian Olek <adrianolek@gmail.com>
Richard Kraaijenhagen <stdin+git@riichard.com>
Connor Atherton <c.liam.atherton@gmail.com>
Gary Ye <garysye@gmail.com>
Christian Grete <webmaster@christiangrete.com>
Liza Ramo <liza.h.ramo@gmail.com>
Julian Alexander Murillo <julian.alexander.murillo@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>
Josh Soref <apache@soref.com>
Henry Wong <henryw4k@gmail.com>
Jon Dufresne <jon.dufresne@gmail.com>
Martijn W. van der Lee <martijn@vanderlee.com>
Devin Wilson <dwilson6.github@gmail.com>
Todor Prikumov <tono_pr@abv.bg>
Zack Hall <zackhall@outlook.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 @@
"name": "jquery",
"title": "jQuery",
"description": "JavaScript library for DOM operations",
"version": "3.0.0-beta1",
"version": "1.12.1",
"main": "dist/jquery.js",
"homepage": "https://jquery.com",
"homepage": "http://jquery.com",
"author": {
"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": {
"type": "git",
......@@ -41,14 +41,12 @@
"gzip-js": "0.3.2",
"jsdom": "5.6.1",
"load-grunt-tasks": "1.0.0",
"native-promise-only": "0.7.8-a",
"promises-aplus-tests": "2.1.0",
"q": "1.1.2",
"npm": "2.1.12",
"qunitjs": "1.17.1",
"qunit-assert-step": "1.0.3",
"requirejs": "2.1.17",
"sinon": "1.10.3",
"sizzle": "2.3.0",
"sinon": "1.12.2",
"sizzle": "2.2.1",
"strip-json-comments": "1.0.3",
"testswarm": "1.1.0",
"win-spawn": "2.0.0"
......
......@@ -10,6 +10,7 @@
"undef": true,
"unused": true,
"evil": true,
"sub": true,
// Support: IE < 10, Android < 4.1
......@@ -22,8 +23,8 @@
"JSON": false,
"jQuery": true,
"define": true,
"module": true,
"define": false,
"module": false,
"noGlobal": true
}
}
This diff is collapsed.
......@@ -53,7 +53,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
return responseContainer[ 0 ];
};
// Force json dataType
// force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
......@@ -77,10 +77,10 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
// Save back as free
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;
// Save the callback name for future use
// save the callback name for future use
oldCallbacks.push( callbackName );
}
......
......@@ -4,19 +4,29 @@ define( [
"../ajax",
"../traversing",
"../manipulation",
"../selector"
"../selector",
// Optional event/alias dependency
"../event/alias"
], function( jQuery ) {
// Keep a copy of the old load method
var _load = jQuery.fn.load;
/**
* Load a url into a page
*/
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
var selector, type, response,
self = this,
off = url.indexOf( " " );
if ( off > -1 ) {
selector = jQuery.trim( url.slice( off ) );
selector = jQuery.trim( url.slice( off, url.length ) );
url = url.slice( 0, off );
}
......
......@@ -2,7 +2,51 @@ define( [
"../core"
], 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;
......
......@@ -4,19 +4,23 @@ define( [
// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
var xml;
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
// Support: IE9
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 ) {
xml = undefined;
}
if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
......
......@@ -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 ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
} );
......@@ -43,29 +44,55 @@ jQuery.ajaxTransport( "script", function( s ) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script, callback;
var script,
head = document.head || jQuery( "head" )[ 0 ] || document.documentElement;
return {
send: function( _, complete ) {
script = jQuery( "<script>" ).prop( {
charset: s.scriptCharset,
src: s.url
} ).on(
"load error",
callback = function( evt ) {
script.remove();
callback = null;
if ( evt ) {
complete( evt.type === "error" ? 404 : 200, evt.type );
send: function( _, callback ) {
script = document.createElement( "script" );
script.async = true;
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
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
document.head.appendChild( script[ 0 ] );
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( callback ) {
callback();
if ( script ) {
script.onload( undefined, true );
}
}
};
......
This diff is collapsed.
define( [
"./core",
"./attributes/val",
"./attributes/attr",
"./attributes/prop",
"./attributes/classes",
"./attributes/val"
"./attributes/classes"
], function( jQuery ) {
// Return jQuery for attributes-only inclusion
......
......@@ -3,18 +3,15 @@ define( [
"../core/access",
"./support",
"../var/rnotwhite",
"./val",
"../selector"
], function( jQuery, access, support, rnotwhite ) {
var boolHook,
var nodeHook, boolHook,
attrHandle = jQuery.expr.attrHandle,
// Exclusively lowercase A-Z in attribute names (gh-2730)
// https://dom.spec.whatwg.org/#converted-to-ascii-lowercase
raz = /[A-Z]+/g,
lowercase = function( ch ) {
return ch.toLowerCase();
};
ruseDefault = /^(?:checked|selected)$/i,
getSetAttribute = support.getSetAttribute,
getSetInput = support.input;
jQuery.fn.extend( {
attr: function( name, value ) {
......@@ -46,9 +43,9 @@ jQuery.extend( {
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
name = name.replace( raz, lowercase );
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
......@@ -81,6 +78,9 @@ jQuery.extend( {
set: function( elem, value ) {
if ( !support.radioValue && value === "radio" &&
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;
elem.setAttribute( "type", value );
if ( val ) {
......@@ -93,13 +93,34 @@ jQuery.extend( {
},
removeAttr: function( elem, value ) {
var name,
var name, propName,
i = 0,
attrNames = value && value.match( rnotwhite );
if ( attrNames && elem.nodeType === 1 ) {
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 = {
// Remove boolean attributes when set to false
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 {
elem.setAttribute( name, name );
// Support: IE<9
// Use defaultChecked and defaultSelected for oldIE
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
}
return name;
}
......@@ -122,20 +151,131 @@ boolHook = {
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
var getter = attrHandle[ name ] || jQuery.find.attr;
attrHandle[ name ] = function( elem, name, isXML ) {
var ret, handle;
if ( !isXML ) {
// Avoid an infinite loop by temporarily removing this function from the getter
handle = attrHandle[ name ];
attrHandle[ name ] = ret;
ret = getter( elem, name, isXML ) != null ?
name.toLowerCase() :
null;
attrHandle[ name ] = handle;
if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
attrHandle[ name ] = function( elem, name, isXML ) {
var ret, handle;
if ( !isXML ) {
// Avoid an infinite loop by temporarily removing this function from the getter
handle = attrHandle[ name ];
attrHandle[ name ] = ret;
ret = getter( elem, name, isXML ) != null ?
name.toLowerCase() :
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( [
"../core",
"../var/rnotwhite",
"../data/var/dataPriv",
"../core/init"
], function( jQuery, rnotwhite, dataPriv ) {
], function( jQuery, rnotwhite ) {
var rclass = /[\t\r\n\f]/g;
function getClass( elem ) {
return elem.getAttribute && elem.getAttribute( "class" ) || "";
return jQuery.attr( elem, "class" ) || "";
}
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 );
if ( curValue !== finalValue ) {
elem.setAttribute( "class", finalValue );
jQuery.attr( elem, "class", finalValue );
}
}
}
......@@ -87,7 +86,7 @@ jQuery.fn.extend( {
// Only assign if different to avoid unneeded rendering.
finalValue = jQuery.trim( cur );
if ( curValue !== finalValue ) {
elem.setAttribute( "class", finalValue );
jQuery.attr( elem, "class", finalValue );
}
}
}
......@@ -137,21 +136,19 @@ jQuery.fn.extend( {
className = getClass( this );
if ( className ) {
// Store className if set
dataPriv.set( this, "__className__", className );
// store className if set
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).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
if ( this.setAttribute ) {
this.setAttribute( "class",
className || value === false ?
"" :
dataPriv.get( this, "__className__" ) || ""
);
}
jQuery.attr( this, "class",
className || value === false ?
"" :
jQuery._data( this, "__className__" ) || ""
);
}
} );
},
......
......@@ -5,7 +5,7 @@ define( [
"../selector"
], function( jQuery, access, support ) {
var rfocusable = /^(?:input|select|textarea|button)$/i,
var rfocusable = /^(?:input|select|textarea|button|object)$/i,
rclickable = /^(?:a|area)$/i;
jQuery.fn.extend( {
......@@ -14,8 +14,14 @@ jQuery.fn.extend( {
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
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( {
}
} );
// 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 ) {
jQuery.propHooks.selected = {
get: function( elem ) {
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;
}
......@@ -106,4 +135,9 @@ jQuery.each( [
jQuery.propFix[ this.toLowerCase() ] = this;
} );
// IE6/7 call enctype encoding
if ( !support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
} );
......@@ -4,25 +4,64 @@ define( [
], function( document, support ) {
( function() {
var input = document.createElement( "input" ),
var a,
input = document.createElement( "input" ),
div = document.createElement( "div" ),
select = document.createElement( "select" ),
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
// Default value for a checkbox should be "on"
support.checkOn = input.value !== "";
// Support: Windows Web Apps (WWA)
// `type` must use .setAttribute for WWA (#14901)
input.setAttribute( "type", "checkbox" );
div.appendChild( input );
// Support: IE<=11+
// Must access selectedIndex to make default options select
a = div.getElementsByTagName( "a" )[ 0 ];
// 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: IE<=11+
// An input loses its value after becoming a radio
// Tests for enctype support on a form (#6743)
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.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
// Check if an input maintains its value after becoming a radio
input.value = "t";
input.type = "radio";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
} )();
......
......@@ -16,7 +16,8 @@ jQuery.fn.extend( {
hooks = jQuery.valHooks[ elem.type ] ||
jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks &&
if (
hooks &&
"get" in hooks &&
( ret = hooks.get( elem, "value" ) ) !== undefined
) {
......@@ -27,10 +28,10 @@ jQuery.fn.extend( {
return typeof ret === "string" ?
// Handle most common string cases
// handle most common string cases
ret.replace( rreturn, "" ) :
// Handle cases where value is null/undef or number
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
......@@ -55,10 +56,8 @@ jQuery.fn.extend( {
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map( val, function( value ) {
return value == null ? "" : value + "";
......@@ -79,10 +78,13 @@ jQuery.extend( {
valHooks: {
option: {
get: function( elem ) {
var val = jQuery.find.attr( elem, "value" );
return val != null ?
val :
// Support: IE<11
// option.value not trimmed (#14858)
return jQuery.trim( elem.value );
// Support: IE10-11+
// option.text throws exceptions (#14686, #14858)
jQuery.trim( jQuery.text( elem ) );
}
},
select: {
......@@ -90,7 +92,7 @@ jQuery.extend( {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one",
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
......@@ -101,11 +103,13 @@ jQuery.extend( {
for ( ; i < max; 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 ) &&
// 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 ||
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
......@@ -133,10 +137,24 @@ jQuery.extend( {
while ( i-- ) {
option = options[ i ];
if ( option.selected =
jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
) {
optionSet = true;
if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) >= 0 ) {
// 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( {
if ( !optionSet ) {
elem.selectedIndex = -1;
}
return values;
return options;
}
}
}
......
......@@ -190,9 +190,9 @@ jQuery.Callbacks = function( options ) {
// Also disable .add unless we have memory (since it would have no effect)
// Abort any pending executions
lock: function() {
locked = queue = [];
if ( !memory && !firing ) {
list = memory = "";
locked = true;
if ( !memory ) {
self.disable();
}
return this;
},
......
define( [
"./var/arr",
"./var/deletedIds",
"./var/document",
"./var/slice",
"./var/concat",
......@@ -8,10 +8,9 @@ define( [
"./var/class2type",
"./var/toString",
"./var/hasOwn",
"./var/support",
"./core/DOMEval"
], function( arr, document, slice, concat,
push, indexOf, class2type, toString, hasOwn, support, DOMEval ) {
"./var/support"
], function( deletedIds, document, slice, concat, push, indexOf,
class2type, toString, hasOwn, support ) {
var
version = "@VERSION",
......@@ -24,13 +23,13 @@ var
return new jQuery.fn.init( selector, context );
},
// Support: Android<4.1
// Support: Android<4.1, IE<9
// Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([a-z])/g,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
......@@ -44,6 +43,9 @@ jQuery.fn = jQuery.prototype = {
constructor: jQuery,
// Start with an empty selector
selector: "",
// The default length of a jQuery object is 0
length: 0,
......@@ -72,6 +74,7 @@ jQuery.fn = jQuery.prototype = {
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set
return ret;
......@@ -113,12 +116,12 @@ jQuery.fn = jQuery.prototype = {
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: arr.sort,
splice: arr.splice
sort: deletedIds.sort,
splice: deletedIds.splice
};
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
var src, copyIsArray, copy, name, options, clone,
target = arguments[ 0 ] || {},
i = 1,
length = arguments.length,
......@@ -128,7 +131,7 @@ jQuery.extend = jQuery.fn.extend = function() {
if ( typeof target === "boolean" ) {
deep = target;
// Skip the boolean and the target
// skip the boolean and the target
target = arguments[ i ] || {};
i++;
}
......@@ -138,7 +141,7 @@ jQuery.extend = jQuery.fn.extend = function() {
target = {};
}
// Extend jQuery itself if only one argument is passed
// extend jQuery itself if only one argument is passed
if ( i === length ) {
target = this;
i--;
......@@ -200,72 +203,103 @@ jQuery.extend( {
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 ) {
return jQuery.type( obj ) === "function";
},
isArray: Array.isArray,
isArray: Array.isArray || function( obj ) {
return jQuery.type( obj ) === "array";
},
isWindow: function( obj ) {
return obj != null && obj === obj.window;
/* jshint eqeqeq: false */
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
// As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects)
// that can be coerced to finite numbers (gh-2662)
var type = jQuery.type( obj );
return ( type === "number" || type === "string" ) &&
( obj - parseFloat( obj ) + 1 ) >= 0;
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
// adding 1 corrects loss of precision from parseFloat (#15100)
var realStringObj = obj && obj.toString();
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 ) {
var key;
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
// - DOM nodes
// - window
if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
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" ) ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// If the function hasn't returned already, we're confident that
// |obj| is a plain object, created by {} or constructed with new Object
return true;
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
// Support: IE<9
// Handle iteration over inherited properties before own properties.
if ( !support.ownFirst ) {
for ( key in obj ) {
return hasOwn.call( obj, key );
}
}
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 ) {
if ( obj == null ) {
return obj + "";
}
// Support: Android<4.0 (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" :
typeof obj;
},
// Evaluates a script in a global context
globalEval: function( code ) {
DOMEval( code );
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
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
// Support: IE9-11+
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
......@@ -296,7 +330,7 @@ jQuery.extend( {
return obj;
},
// Support: Android<4.1
// Support: Android<4.1, IE<9
trim: function( text ) {
return text == null ?
"" :
......@@ -322,18 +356,43 @@ jQuery.extend( {
},
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 ) {
var len = +second.length,
j = 0,
i = first.length;
for ( ; j < len; j++ ) {
first[ i++ ] = second[ j ];
while ( j < len ) {
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;
......@@ -398,7 +457,7 @@ jQuery.extend( {
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
var args, proxy, tmp;
if ( typeof context === "string" ) {
tmp = fn[ context ];
......@@ -424,7 +483,9 @@ jQuery.extend( {
return proxy;
},
now: Date.now,
now: function() {
return +( new Date() );
},
// jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist.
......@@ -437,7 +498,7 @@ jQuery.extend( {
// three lines.
/* jshint ignore: start */
if ( typeof Symbol === "function" ) {
jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
}
/* jshint ignore: end */
......
......@@ -6,7 +6,7 @@ define( [
// The value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
len = elems.length,
length = elems.length,
bulk = key == null;
// Sets many values
......@@ -41,11 +41,11 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
}
if ( fn ) {
for ( ; i < len; i++ ) {
for ( ; i < length; i++ ) {
fn(
elems[ i ], key, raw ?
value :
value.call( elems[ i ], i, fn( elems[ i ], key ) )
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 ) {
// Gets
bulk ?
fn.call( elems ) :
len ? fn( elems[ 0 ], key ) : emptyGet;
length ? fn( elems[ 0 ], key ) : emptyGet;
};
return access;
......
......@@ -12,8 +12,7 @@ var rootjQuery,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// 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 ) {
var match, elem;
......@@ -23,14 +22,14 @@ var rootjQuery,
return this;
}
// Method init() accepts an alternate rootjQuery
// init accepts an alternate rootjQuery
// so migrate can support jQuery.sub (gh-2101)
root = root || rootjQuery;
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector[ 0 ] === "<" &&
selector[ selector.length - 1 ] === ">" &&
if ( selector.charAt( 0 ) === "<" &&
selector.charAt( selector.length - 1 ) === ">" &&
selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
......@@ -47,7 +46,7 @@ var rootjQuery,
if ( match[ 1 ] ) {
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
jQuery.merge( this, jQuery.parseHTML(
match[ 1 ],
......@@ -76,12 +75,23 @@ var rootjQuery,
} else {
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
this[ 0 ] = elem;
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[ 2 ] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[ 0 ] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
......@@ -97,20 +107,25 @@ var rootjQuery,
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
this[ 0 ] = selector;
this.context = this[ 0 ] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return root.ready !== undefined ?
return typeof root.ready !== "undefined" ?
root.ready( selector ) :
// Execute immediately if ready is not present
selector( jQuery );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
};
......
......@@ -8,21 +8,21 @@ define( [
"./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,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) {
if ( typeof data !== "string" ) {
return [];
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
// Stop scripts or inline event handlers from being executed immediately
// by using document.implementation
// document.implementation stops scripts or inline event handlers from
// being executed immediately
context = context || ( support.createHTMLDocument ?
document.implementation.createHTMLDocument( "" ) :
document );
......
define( [
"../core",
"../var/document",
"../core/init",
"../deferred"
], function( jQuery, document ) {
......@@ -51,16 +52,42 @@ jQuery.extend( {
// If there are functions bound, to execute
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
*/
function completed() {
document.removeEventListener( "DOMContentLoaded", completed );
window.removeEventListener( "load", completed );
jQuery.ready();
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener ||
window.event.type === "load" ||
document.readyState === "complete" ) {
detach();
jQuery.ready();
}
}
jQuery.ready.promise = function( obj ) {
......@@ -70,7 +97,7 @@ jQuery.ready.promise = function( obj ) {
// Catch cases where $(document).ready() is called
// after the browser event has already occurred.
// Support: IE9-10 only
// Support: IE6-10
// Older IE sometimes signals "interactive" too soon
if ( document.readyState === "complete" ||
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
......@@ -78,13 +105,53 @@ jQuery.ready.promise = function( obj ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
window.setTimeout( jQuery.ready );
} else {
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed );
// A fallback to window.onload, that will always work
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 );
......
......@@ -9,9 +9,12 @@ define( [
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = ( function() {
var body = document.implementation.createHTMLDocument( "" ).body;
body.innerHTML = "<form></form><form></form>";
return body.childNodes.length === 2;
if ( !document.implementation.createHTMLDocument ) {
return false;
}
var doc = document.implementation.createHTMLDocument( "" );
doc.body.innerHTML = "<form></form><form></form>";
return doc.body.childNodes.length === 2;
} )();
return support;
......
define( function() {
// 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( [
"exports",
"../core",
"../var/documentElement",
"./var/rnumnonpx",
"./var/rmargin",
"./var/getStyles",
"./support",
"../selector" // Get jQuery.contains
], function( jQuery, rnumnonpx, rmargin, getStyles, support ) {
"../selector" // contains
], function( exports, jQuery, documentElement, rnumnonpx, rmargin, support ) {
function curCSS( elem, name, computed ) {
var width, minWidth, maxWidth, ret,
style = elem.style;
var getStyles, curCSS,
rposition = /^(top|right|bottom|left)$/;
computed = computed || getStyles( elem );
if ( window.getComputedStyle ) {
getStyles = function( elem ) {
// Support: IE9
// getPropertyValue is only needed for .css('filter') (#12537)
if ( computed ) {
ret = computed.getPropertyValue( name ) || computed[ name ];
// Support: IE<=11+, Firefox<=30+ (#15098, #14150)
// IE throws on elements created in popups
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
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 );
}
// A tribute to the "awesome hack by Dean Edwards"
// Android Browser returns percentage for some 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 ) ) {
if ( computed ) {
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value"
// instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values,
// but width seems to be reliably pixels
// this is against the CSSOM draft spec:
// http://dev.w3.org/csswg/cssom/#resolved-values
if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
// Support: IE
// IE returns zIndex value as an integer.
return ret === undefined ?
ret :
ret + "";
};
} else if ( documentElement.currentStyle ) {
getStyles = function( elem ) {
return elem.currentStyle;
};
curCSS = function( elem, name, computed ) {
var left, rs, rsLeft, ret,
style = elem.style;
computed = computed || getStyles( elem );
ret = computed ? computed[ name ] : undefined;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are
// proportional to the parent element instead
// and we can't measure the parent instead because it
// might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
left = style.left;
rs = elem.runtimeStyle;
rsLeft = rs && rs.left;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
if ( rsLeft ) {
rs.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
style.left = left;
if ( rsLeft ) {
rs.left = rsLeft;
}
}
}
return ret !== undefined ?
// Support: IE9-11+
// Support: IE
// IE returns zIndex value as an integer.
ret + "" :
ret;
return ret === undefined ?
ret :
ret + "" || "auto";
};
}
return curCSS;
exports.getStyles = getStyles;
exports.curCSS = curCSS;
} );
......@@ -51,7 +51,7 @@ function defaultDisplay( nodeName ) {
.appendTo( doc.documentElement );
// 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
doc.write();
......
define( [
"../core",
"../selector"
], function( jQuery ) {
"./support",
"../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 ) {
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 ) {
return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
return !jQuery.expr.filters.hidden( elem );
};
} );
define( [
"../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;
}
define( [], function() {
function showHide( elements, show ) {
var display, elem,
values = [],
......@@ -44,35 +14,23 @@ function showHide( elements, show ) {
display = elem.style.display;
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" ) {
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 {
if ( display !== "none" ) {
values[ index ] = "none";
// Remember what we're overwriting
dataPriv.set( elem, "display", display );
// Remember the value we're replacing
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++ ) {
if ( values[ index ] != null ) {
elements[ index ].style.display = values[ index ];
......@@ -82,27 +40,6 @@ function showHide( elements, show ) {
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;
} );
......@@ -6,7 +6,8 @@ define( [
], function( jQuery, document, documentElement, support ) {
( function() {
var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal,
reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal,
container = document.createElement( "div" ),
div = document.createElement( "div" );
......@@ -15,74 +16,166 @@ define( [
return;
}
// Support: IE9-11+
// Style of cloned element affects source element cloned (#8908)
div.style.cssText = "float:left;opacity:.5";
// 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.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
container = document.createElement( "div" );
container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
"padding:0;margin-top:1px;position:absolute";
div.innerHTML = "";
container.appendChild( div );
// Executing both pixelPosition & boxSizingReliable tests require only one layout
// so they're executed at the same time to save the second computation.
function computeStyleTests() {
div.style.cssText =
"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 );
}
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" ||
div.style.WebkitBoxSizing === "";
jQuery.extend( support, {
pixelPosition: function() {
// This test is executed only once but we still do memoizing
// since we can use the boxSizingReliable pre-computing.
// No need to check if the test was already performed, though.
computeStyleTests();
return pixelPositionVal;
reliableHiddenOffsets: function() {
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableHiddenOffsetsVal;
},
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();
}
return boxSizingReliableVal;
},
pixelMarginRight: function() {
// Support: Android 4.0-4.3
// We're checking for boxSizingReliableVal here instead of pixelMarginRightVal
// since that compresses better and they're computed together anyway.
if ( boxSizingReliableVal == null ) {
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return pixelMarginRightVal;
},
pixelPosition: function() {
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return pixelPositionVal;
},
reliableMarginRight: function() {
// Support: Android 2.3
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableMarginRightVal;
},
reliableMarginLeft: function() {
// Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37
if ( boxSizingReliableVal == null ) {
if ( pixelPositionVal == null ) {
computeStyleTests();
}
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;
......
This diff is collapsed.
define( function() {
define( [
"../../core"
], function( jQuery ) {
/**
* 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:
// - Node
// - Node.ELEMENT_NODE
// - Node.DOCUMENT_NODE
// - Object
// - Any
/* jshint -W018 */
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
// Do not set data on non-element DOM nodes because it will not be cleared (#8335).
return nodeType !== 1 && nodeType !== 9 ?
false :
// Nodes accept data unless otherwise specified; rejection can be conditional
!noData || noData !== true && elem.getAttribute( "classid" ) === noData;
};
} );
This diff is collapsed.
define( [
"./core"
"./core",
"./traversing"
], function( jQuery ) {
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( [
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
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 ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
......@@ -19,10 +19,10 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
if ( jQuery.isWindow( elem ) ) {
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
return funcName.indexOf( "outer" ) === 0 ?
elem[ "inner" + name ] :
elem.document.documentElement[ "client" + name ];
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
......@@ -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],
// 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(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
......@@ -45,7 +47,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// Set width or height on the element
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 = {
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var hooks = Tween.propHooks[ this.prop ];
var eased,
hooks = Tween.propHooks[ this.prop ];
this.pos = this.options.duration ?
jQuery.easing[ this.easing ]( percent ) :
percent;
this.now = ( this.end - this.start ) * this.pos + this.start;
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
......@@ -61,10 +66,10 @@ Tween.propHooks = {
return tween.elem[ tween.prop ];
}
// Passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails.
// Simple values such as "10px" are parsed to Float;
// complex values such as "rotate(1rad)" are returned as-is.
// passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css( tween.elem, tween.prop, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
......@@ -72,9 +77,8 @@ Tween.propHooks = {
},
set: function( tween ) {
// Use step hook for back compat.
// Use cssHook if its there.
// Use .style if available and use plain properties where available.
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.nodeType === 1 &&
......@@ -88,8 +92,9 @@ Tween.propHooks = {
}
};
// Support: IE9
// Support: IE <=9
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
......
This diff is collapsed.
define( [
"../core",
"../event",
"./trigger"
"../event"
], 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 " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
"change select submit keydown keypress keyup error contextmenu" ).split( " " ),
function( i, name ) {
// Handle event binding
......
define( [
"../var/document",
"../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;
......
......@@ -18,8 +18,8 @@ jQuery.noConflict = function( deep ) {
return jQuery;
};
// Expose jQuery and $ identifiers, even in AMD
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// Expose jQuery and $ identifiers, even in
// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
if ( !noGlobal ) {
window.jQuery = window.$ = jQuery;
......
/*!
* jQuery JavaScript Library v@VERSION
* https://jquery.com/
* http://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
* http://sizzlejs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
* http://jquery.org/license
*
* Date: @DATE
*/
......
......@@ -4,15 +4,14 @@ define( [
"./traversing",
"./callbacks",
"./deferred",
"./deferred/exceptionHook",
"./core/ready",
"./support",
"./data",
"./queue",
"./queue/delay",
"./attributes",
"./event",
"./event/alias",
"./event/focusin",
"./manipulation",
"./manipulation/_evalUrl",
"./wrap",
......
This diff is collapsed.
define( [
"../core",
"./var/rcheckableType",
"./var/rtagName",
"./var/rscriptType",
"./var/rleadingWhitespace",
"./createSafeFragment",
"./wrapMap",
"./getAll",
"./setGlobalEval"
], function( jQuery, rtagName, rscriptType, wrapMap, getAll, setGlobalEval ) {
"./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 ) {
var elem, tmp, tag, wrap, contains, j,
fragment = context.createDocumentFragment(),
var j, elem, contains,
tmp, tag, tbody, wrap,
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [],
i = 0,
l = elems.length;
i = 0;
for ( ; i < l; i++ ) {
elem = elems[ i ];
......@@ -23,9 +39,6 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
// Add nodes directly
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 );
// Convert non-html into a text node
......@@ -34,11 +47,12 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
// Convert html into DOM nodes
} else {
tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
tmp = tmp || safe.appendChild( context.createElement( "div" ) );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
// Descend through wrappers to the right content
......@@ -47,21 +61,59 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
tmp = tmp.lastChild;
}
// Support: Android<4.1, PhantomJS<2
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( nodes, tmp.childNodes );
// Manually add leading whitespace removed by IE
if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
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
tmp = fragment.firstChild;
j = elem && elem.childNodes.length;
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 = "";
// 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
fragment.textContent = "";
// Fix #11356: Clear elements from fragment
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;
while ( ( elem = nodes[ i++ ] ) ) {
......@@ -71,13 +123,14 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
if ( ignored ) {
ignored.push( elem );
}
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( fragment.appendChild( elem ), "script" );
tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
......@@ -95,7 +148,9 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
}
}
return fragment;
tmp = null;
return safe;
}
return buildFragment;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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