diff --git a/.travis.yml b/.travis.yml index 29539401f3..e5d123462d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,5 @@ branches: - /^(.*\/)?ci-.*$/ before_install: - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi - - if [[ `npm -v` != 5.6* ]]; then npm i -g npm@5.6.0; fi script: - ./build.sh \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/npm-shrinkwrap.json b/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/npm-shrinkwrap.json index 0820340839..de9bb13639 100644 --- a/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/npm-shrinkwrap.json +++ b/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/npm-shrinkwrap.json @@ -145,158 +145,132 @@ "aurelia-binding": { "version": "1.2.1", "from": "aurelia-binding@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-binding/-/aurelia-binding-1.2.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-binding/-/aurelia-binding-1.2.1.tgz" }, "aurelia-bootstrapper": { "version": "2.1.1", "from": "aurelia-bootstrapper@>=2.0.1 <3.0.0", - "resolved": "https://registry.npmjs.org/aurelia-bootstrapper/-/aurelia-bootstrapper-2.1.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-bootstrapper/-/aurelia-bootstrapper-2.1.1.tgz" }, "aurelia-dependency-injection": { "version": "1.3.1", "from": "aurelia-dependency-injection@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-dependency-injection/-/aurelia-dependency-injection-1.3.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-dependency-injection/-/aurelia-dependency-injection-1.3.1.tgz" }, "aurelia-event-aggregator": { "version": "1.0.1", "from": "aurelia-event-aggregator@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-event-aggregator/-/aurelia-event-aggregator-1.0.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-event-aggregator/-/aurelia-event-aggregator-1.0.1.tgz" }, "aurelia-fetch-client": { "version": "1.1.2", "from": "aurelia-fetch-client@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-fetch-client/-/aurelia-fetch-client-1.1.2.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-fetch-client/-/aurelia-fetch-client-1.1.2.tgz" }, "aurelia-framework": { "version": "1.1.2", "from": "aurelia-framework@>=1.1.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-framework/-/aurelia-framework-1.1.2.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-framework/-/aurelia-framework-1.1.2.tgz" }, "aurelia-history": { "version": "1.0.0", "from": "aurelia-history@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-history/-/aurelia-history-1.0.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-history/-/aurelia-history-1.0.0.tgz" }, "aurelia-history-browser": { "version": "1.0.0", "from": "aurelia-history-browser@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-history-browser/-/aurelia-history-browser-1.0.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-history-browser/-/aurelia-history-browser-1.0.0.tgz" }, "aurelia-hot-module-reload": { "version": "0.1.0", "from": "aurelia-hot-module-reload@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/aurelia-hot-module-reload/-/aurelia-hot-module-reload-0.1.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-hot-module-reload/-/aurelia-hot-module-reload-0.1.0.tgz" }, "aurelia-loader": { "version": "1.0.0", "from": "aurelia-loader@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-loader/-/aurelia-loader-1.0.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-loader/-/aurelia-loader-1.0.0.tgz" }, "aurelia-loader-default": { "version": "1.0.2", "from": "aurelia-loader-default@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-loader-default/-/aurelia-loader-default-1.0.2.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-loader-default/-/aurelia-loader-default-1.0.2.tgz" }, "aurelia-loader-webpack": { "version": "2.1.0", "from": "aurelia-loader-webpack@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/aurelia-loader-webpack/-/aurelia-loader-webpack-2.1.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-loader-webpack/-/aurelia-loader-webpack-2.1.0.tgz" }, "aurelia-logging": { "version": "1.3.1", "from": "aurelia-logging@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-logging/-/aurelia-logging-1.3.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-logging/-/aurelia-logging-1.3.1.tgz" }, "aurelia-logging-console": { "version": "1.0.0", "from": "aurelia-logging-console@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-logging-console/-/aurelia-logging-console-1.0.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-logging-console/-/aurelia-logging-console-1.0.0.tgz" }, "aurelia-metadata": { "version": "1.0.3", "from": "aurelia-metadata@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-metadata/-/aurelia-metadata-1.0.3.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-metadata/-/aurelia-metadata-1.0.3.tgz" }, "aurelia-pal": { "version": "1.3.0", "from": "aurelia-pal@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-pal/-/aurelia-pal-1.3.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-pal/-/aurelia-pal-1.3.0.tgz" }, "aurelia-pal-browser": { "version": "1.2.1", "from": "aurelia-pal-browser@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-pal-browser/-/aurelia-pal-browser-1.2.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-pal-browser/-/aurelia-pal-browser-1.2.1.tgz" }, "aurelia-path": { "version": "1.1.1", "from": "aurelia-path@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-path/-/aurelia-path-1.1.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-path/-/aurelia-path-1.1.1.tgz" }, "aurelia-polyfills": { "version": "1.2.1", "from": "aurelia-polyfills@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-polyfills/-/aurelia-polyfills-1.2.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-polyfills/-/aurelia-polyfills-1.2.1.tgz" }, "aurelia-route-recognizer": { "version": "1.1.0", "from": "aurelia-route-recognizer@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-route-recognizer/-/aurelia-route-recognizer-1.1.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-route-recognizer/-/aurelia-route-recognizer-1.1.0.tgz" }, "aurelia-router": { "version": "1.3.0", "from": "aurelia-router@>=1.2.1 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-router/-/aurelia-router-1.3.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-router/-/aurelia-router-1.3.0.tgz" }, "aurelia-task-queue": { "version": "1.2.0", "from": "aurelia-task-queue@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-task-queue/-/aurelia-task-queue-1.2.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-task-queue/-/aurelia-task-queue-1.2.0.tgz" }, "aurelia-templating": { "version": "1.4.2", "from": "aurelia-templating@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-templating/-/aurelia-templating-1.4.2.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-templating/-/aurelia-templating-1.4.2.tgz" }, "aurelia-templating-binding": { "version": "1.3.0", "from": "aurelia-templating-binding@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-templating-binding/-/aurelia-templating-binding-1.3.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-templating-binding/-/aurelia-templating-binding-1.3.0.tgz" }, "aurelia-templating-resources": { "version": "1.4.0", "from": "aurelia-templating-resources@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-templating-resources/-/aurelia-templating-resources-1.4.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-templating-resources/-/aurelia-templating-resources-1.4.0.tgz" }, "aurelia-templating-router": { "version": "1.1.0", "from": "aurelia-templating-router@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/aurelia-templating-router/-/aurelia-templating-router-1.1.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/aurelia-templating-router/-/aurelia-templating-router-1.1.0.tgz" }, "aurelia-webpack-plugin": { "version": "2.0.0-rc.2", @@ -349,8 +323,7 @@ "bootstrap": { "version": "3.3.7", "from": "bootstrap@>=3.3.7 <4.0.0", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.3.7.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.3.7.tgz" }, "brace-expansion": { "version": "1.1.8", @@ -739,8 +712,7 @@ "encoding": { "version": "0.1.12", "from": "encoding@>=0.1.11 <0.2.0", - "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz" }, "enhanced-resolve": { "version": "3.1.0", @@ -1017,8 +989,7 @@ "iconv-lite": { "version": "0.4.18", "from": "iconv-lite@>=0.4.13 <0.5.0", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz" }, "icss-replace-symbols": { "version": "1.1.0", @@ -1181,8 +1152,7 @@ "is-stream": { "version": "1.1.0", "from": "is-stream@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz" }, "is-svg": { "version": "2.1.0", @@ -1211,14 +1181,12 @@ "isomorphic-fetch": { "version": "2.2.1", "from": "isomorphic-fetch@>=2.2.1 <3.0.0", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz" }, "jquery": { - "version": "3.3.1", - "from": "jquery@3.3.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", - "dev": true + "version": "3.2.1", + "from": "jquery@>=3.2.1 <4.0.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.2.1.tgz" }, "js-base64": { "version": "2.1.9", @@ -1441,8 +1409,7 @@ "node-fetch": { "version": "1.7.1", "from": "node-fetch@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.1.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.1.tgz" }, "node-libs-browser": { "version": "2.0.0", @@ -2560,8 +2527,7 @@ "whatwg-fetch": { "version": "2.0.3", "from": "whatwg-fetch@>=0.10.0", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz", - "dev": true + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz" }, "whet.extend": { "version": "0.9.9", diff --git a/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/package.json b/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/package.json index f77a1cc90e..cc8cc6b145 100644 --- a/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/package.json +++ b/src/Microsoft.AspNetCore.SpaTemplates/content/Aurelia-CSharp/package.json @@ -18,7 +18,7 @@ "file-loader": "^0.11.1", "html-loader": "^0.4.5", "isomorphic-fetch": "^2.2.1", - "jquery": "^3.3.1", + "jquery": "^3.2.1", "json-loader": "^0.5.4", "style-loader": "^0.16.1", "ts-loader": "^2.0.3", diff --git a/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/npm-shrinkwrap.json b/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/npm-shrinkwrap.json index 624c4d6939..8c897ce31a 100644 --- a/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/npm-shrinkwrap.json +++ b/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/npm-shrinkwrap.json @@ -1069,9 +1069,9 @@ "dev": true }, "jquery": { - "version": "3.3.1", - "from": "jquery@3.3.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", + "version": "2.2.4", + "from": "jquery@>=2.2.1 <3.0.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz", "dev": true }, "js-base64": { diff --git a/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/package.json b/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/package.json index 5fee822732..86722a708f 100644 --- a/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/package.json +++ b/src/Microsoft.AspNetCore.SpaTemplates/content/Knockout-CSharp/package.json @@ -22,7 +22,7 @@ "file-loader": "^0.9.0", "history": "^4.6.3", "isomorphic-fetch": "^2.2.1", - "jquery": "^3.3.1", + "jquery": "^2.2.1", "json-loader": "^0.5.4", "knockout": "^3.4.0", "raw-loader": "^0.5.1", diff --git a/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/npm-shrinkwrap.json b/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/npm-shrinkwrap.json index 02c7a5b93b..31558445fd 100644 --- a/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/npm-shrinkwrap.json +++ b/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/npm-shrinkwrap.json @@ -1097,9 +1097,9 @@ "dev": true }, "jquery": { - "version": "3.3.1", - "from": "jquery@3.3.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", + "version": "3.2.1", + "from": "jquery@>=3.1.1 <4.0.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.2.1.tgz", "dev": true }, "js-base64": { diff --git a/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/package.json b/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/package.json index 79f96c081d..821a60c5cb 100644 --- a/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/package.json +++ b/src/Microsoft.AspNetCore.SpaTemplates/content/Vue-CSharp/package.json @@ -12,7 +12,7 @@ "extract-text-webpack-plugin": "^2.0.0-rc", "file-loader": "^0.9.0", "isomorphic-fetch": "^2.2.1", - "jquery": "^3.3.1", + "jquery": "^3.1.1", "style-loader": "^0.13.1", "typescript": "^2.2.1", "url-loader": "^0.5.7", diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/.bower.json b/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/.bower.json index 959ddb7137..419488b5bc 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/.bower.json +++ b/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/.bower.json @@ -12,15 +12,14 @@ "library" ], "homepage": "https://github.com/jquery/jquery-dist", - "version": "3.3.1", - "_release": "3.3.1", + "version": "2.2.0", + "_release": "2.2.0", "_resolution": { "type": "version", - "tag": "3.3.1", - "commit": "9e8ec3d10fad04748176144f108d7355662ae75e" + "tag": "2.2.0", + "commit": "6fc01e29bdad0964f62ef56d01297039cdcadbe5" }, - "_source": "https://github.com/jquery/jquery-dist.git", - "_target": "^3.3.1", - "_originalSource": "jquery", - "_direct": true + "_source": "git://github.com/jquery/jquery-dist.git", + "_target": "2.2.0", + "_originalSource": "jquery" } \ No newline at end of file diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/LICENSE.txt b/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/LICENSE.txt index e4e5e00ef0..5312a4c864 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/LICENSE.txt +++ b/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright JS Foundation and other contributors, https://js.foundation/ +Copyright jQuery Foundation and other contributors, https://jquery.org/ This software consists of voluntary contributions made by many individuals. For exact contribution history, see the revision history diff --git a/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/dist/jquery.js b/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/dist/jquery.js index 9b5206bcc6..1e0ba99740 100644 --- a/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/dist/jquery.js +++ b/src/Microsoft.DotNet.Web.ProjectTemplates/content/RazorPagesWeb-CSharp/wwwroot/lib/jquery/dist/jquery.js @@ -1,22 +1,20 @@ /*! - * jQuery JavaScript Library v3.3.1 - * https://jquery.com/ + * jQuery JavaScript Library v2.2.0 + * http://jquery.com/ * * Includes Sizzle.js - * https://sizzlejs.com/ + * http://sizzlejs.com/ * - * Copyright JS Foundation and other contributors + * Copyright jQuery Foundation and other contributors * Released under the MIT license - * https://jquery.org/license + * http://jquery.org/license * - * Date: 2018-01-20T17:24Z + * Date: 2016-01-08T20:02Z */ -( function( global, factory ) { - "use strict"; +(function( global, factory ) { if ( typeof module === "object" && typeof module.exports === "object" ) { - // For CommonJS and CommonJS-like environments where a proper `window` // is present, execute the factory and get jQuery. // For environments that do not have a `window` with a `document` @@ -37,20 +35,17 @@ } // Pass this if window is not defined yet -} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - -// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 -// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode -// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common -// enough that all such attempts are guarded in a try block. -"use strict"; +}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { +// Support: Firefox 18+ +// Can't be in strict mode, several libs including ASP.NET trace +// the stack via arguments.caller.callee and Firefox dies if +// you try to trace through "use strict" call chains. (#13335) +//"use strict"; var arr = []; var document = window.document; -var getProto = Object.getPrototypeOf; - var slice = arr.slice; var concat = arr.concat; @@ -65,71 +60,12 @@ var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; -var fnToString = hasOwn.toString; - -var ObjectFunctionString = fnToString.call( Object ); - var support = {}; -var isFunction = function isFunction( obj ) { - - // Support: Chrome <=57, Firefox <=52 - // In some browsers, typeof returns "function" for HTML elements - // (i.e., `typeof document.createElement( "object" ) === "function"`). - // We don't want to classify *any* DOM node as a function. - return typeof obj === "function" && typeof obj.nodeType !== "number"; - }; - - -var isWindow = function isWindow( obj ) { - return obj != null && obj === obj.window; - }; - - - - - var preservedScriptAttributes = { - type: true, - src: true, - noModule: true - }; - - function DOMEval( code, doc, node ) { - doc = doc || document; - - var i, - script = doc.createElement( "script" ); - - script.text = code; - if ( node ) { - for ( i in preservedScriptAttributes ) { - if ( node[ i ] ) { - script[ i ] = node[ i ]; - } - } - } - doc.head.appendChild( script ).parentNode.removeChild( script ); - } - - -function toType( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android <=2.3 only (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; -} -/* global Symbol */ -// Defining this global in .eslintrc.json would create a danger of using the global -// unguarded in another place, it seems safer to define global only for this module - var - version = "3.3.1", + version = "2.2.0", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -139,9 +75,18 @@ var return new jQuery.fn.init( selector, context ); }, - // Support: Android <=4.0 only + // Support: Android<4.1 // 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 + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; jQuery.fn = jQuery.prototype = { @@ -150,6 +95,9 @@ jQuery.fn = jQuery.prototype = { constructor: jQuery, + // Start with an empty selector + selector: "", + // The default length of a jQuery object is 0 length: 0, @@ -160,14 +108,13 @@ jQuery.fn = jQuery.prototype = { // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { + return num != null ? - // Return all the elements in a clean array - if ( num == null ) { - return slice.call( this ); - } + // Return just the one element from the set + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : - // Return just the one element from the set - return num < 0 ? this[ num + this.length ] : this[ num ]; + // Return all the elements in a clean array + slice.call( this ); }, // Take an array of elements and push it onto the stack @@ -179,6 +126,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; @@ -241,7 +189,7 @@ jQuery.extend = jQuery.fn.extend = function() { } // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !isFunction( target ) ) { + if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { target = {}; } @@ -268,11 +216,11 @@ jQuery.extend = jQuery.fn.extend = function() { // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = Array.isArray( copy ) ) ) ) { + ( copyIsArray = jQuery.isArray( copy ) ) ) ) { if ( copyIsArray ) { copyIsArray = false; - clone = src && Array.isArray( src ) ? src : []; + clone = src && jQuery.isArray( src ) ? src : []; } else { clone = src && jQuery.isPlainObject( src ) ? src : {}; @@ -307,42 +255,100 @@ jQuery.extend( { noop: function() {}, - isPlainObject: function( obj ) { - var proto, Ctor; + isFunction: function( obj ) { + return jQuery.type( obj ) === "function"; + }, - // Detect obvious negatives - // Use toString instead of jQuery.type to catch host objects - if ( !obj || toString.call( obj ) !== "[object Object]" ) { + isArray: Array.isArray, + + isWindow: function( obj ) { + return obj != null && obj === obj.window; + }, + + isNumeric: function( obj ) { + + // 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; + }, + + isPlainObject: function( obj ) { + + // 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 ) ) { return false; } - proto = getProto( obj ); - - // Objects with no prototype (e.g., `Object.create( null )`) are plain - if ( !proto ) { - return true; + if ( obj.constructor && + !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { + return false; } - // Objects with prototype are plain iff they were constructed by a global Object function - Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; - return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + // 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 ) { - - /* eslint-disable no-unused-vars */ - // See https://github.com/eslint/eslint/issues/6125 var name; - for ( name in obj ) { return false; } return true; }, + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android<4.0, iOS<6 (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 ); + var script, + indirect = eval; + + code = jQuery.trim( code ); + + if ( code ) { + + // If the code includes a valid, prologue position + // strict mode pragma, execute code by injecting a + // script tag into the document. + if ( code.indexOf( "use strict" ) === 1 ) { + script = document.createElement( "script" ); + script.text = code; + document.head.appendChild( script ).parentNode.removeChild( script ); + } else { + + // Otherwise, avoid the DOM node creation, insertion + // and removal by using an indirect global eval + + indirect( code ); + } + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Support: IE9-11+ + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, each: function( obj, callback ) { @@ -366,7 +372,7 @@ jQuery.extend( { return obj; }, - // Support: Android <=4.0 only + // Support: Android<4.1 trim: function( text ) { return text == null ? "" : @@ -395,8 +401,6 @@ jQuery.extend( { return arr == null ? -1 : indexOf.call( arr, elem, i ); }, - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit merge: function( first, second ) { var len = +second.length, j = 0, @@ -465,14 +469,51 @@ jQuery.extend( { // A global GUID counter for objects guid: 1, + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: Date.now, + // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support } ); +// JSHint would error on this code due to the Symbol not being defined in ES5. +// Defining this global in .jshintrc would create a danger of using the global +// unguarded in another place, it seems safer to just disable JSHint for these +// three lines. +/* jshint ignore: start */ if ( typeof Symbol === "function" ) { jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; } +/* jshint ignore: end */ // Populate the class2type map jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), @@ -482,14 +523,14 @@ function( i, name ) { function isArrayLike( obj ) { - // Support: real iOS 8.2 only (not reproducible in simulator) + // Support: iOS 8.2 (not reproducible in simulator) // `in` check used to prevent JIT error (gh-2145) // hasOwn isn't used here due to false negatives // regarding Nodelist length in IE var length = !!obj && "length" in obj && obj.length, - type = toType( obj ); + type = jQuery.type( obj ); - if ( isFunction( obj ) || isWindow( obj ) ) { + if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } @@ -498,14 +539,14 @@ function isArrayLike( obj ) { } var Sizzle = /*! - * Sizzle CSS Selector Engine v2.3.3 - * https://sizzlejs.com/ + * Sizzle CSS Selector Engine v2.2.1 + * http://sizzlejs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * - * Date: 2016-08-08 + * Date: 2015-10-17 */ (function( window ) { @@ -546,6 +587,9 @@ var i, return 0; }, + // General-purpose constants + MAX_NEGATIVE = 1 << 31, + // Instance methods hasOwn = ({}).hasOwnProperty, arr = [], @@ -554,7 +598,7 @@ var i, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 + // http://jsperf.com/thor-indexof-vs-for/5 indexOf = function( list, elem ) { var i = 0, len = list.length; @@ -574,7 +618,7 @@ var i, whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", + identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + @@ -631,9 +675,9 @@ var i, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, + rescape = /'|\\/g, - // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; @@ -649,39 +693,13 @@ var i, String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }, - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }, - // Used for iframes // See setDocument() // Removing the function wrapper causes a "Permission Denied" // error in IE unloadHandler = function() { setDocument(); - }, - - disabledAncestor = addCombinator( - function( elem ) { - return elem.disabled === true && ("form" in elem || "label" in elem); - }, - { dir: "parentNode", next: "legend" } - ); + }; // Optimize for push.apply( _, NodeList ) try { @@ -713,7 +731,7 @@ try { } function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, match, groups, newSelector, + var m, i, elem, nid, nidselect, match, groups, newSelector, newContext = context && context.ownerDocument, // nodeType defaults to 9, since context defaults to document @@ -806,7 +824,7 @@ function Sizzle( selector, context, results, seed ) { // Capture the context ID, setting it first if necessary if ( (nid = context.getAttribute( "id" )) ) { - nid = nid.replace( rcssescape, fcssescape ); + nid = nid.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", (nid = expando) ); } @@ -814,8 +832,9 @@ function Sizzle( selector, context, results, seed ) { // Prefix every selector in the list groups = tokenize( selector ); i = groups.length; + nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; while ( i-- ) { - groups[i] = "#" + nid + " " + toSelector( groups[i] ); + groups[i] = nidselect + " " + toSelector( groups[i] ); } newSelector = groups.join( "," ); @@ -876,22 +895,22 @@ function markFunction( fn ) { /** * Support testing using an element - * @param {Function} fn Passed the created element and returns a boolean result + * @param {Function} fn Passed the created div and expects a boolean result */ function assert( fn ) { - var el = document.createElement("fieldset"); + var div = document.createElement("div"); try { - return !!fn( el ); + return !!fn( div ); } catch (e) { return false; } finally { // Remove from its parent by default - if ( el.parentNode ) { - el.parentNode.removeChild( el ); + if ( div.parentNode ) { + div.parentNode.removeChild( div ); } // release memory in IE - el = null; + div = null; } } @@ -918,7 +937,8 @@ function addHandle( attrs, handler ) { function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; + ( ~b.sourceIndex || MAX_NEGATIVE ) - + ( ~a.sourceIndex || MAX_NEGATIVE ); // Use IE sourceIndex if available on both nodes if ( diff ) { @@ -959,62 +979,6 @@ function createButtonPseudo( type ) { }; } -/** - * Returns a function to use in pseudos for :enabled/:disabled - * @param {Boolean} disabled true for :disabled; false for :enabled - */ -function createDisabledPseudo( disabled ) { - - // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable - return function( elem ) { - - // Only certain elements can match :enabled or :disabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled - if ( "form" in elem ) { - - // Check for inherited disabledness on relevant non-disabled elements: - // * listed form-associated elements in a disabled fieldset - // https://html.spec.whatwg.org/multipage/forms.html#category-listed - // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled - // * option elements in a disabled optgroup - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled - // All such elements have a "form" property. - if ( elem.parentNode && elem.disabled === false ) { - - // Option elements defer to a parent optgroup if present - if ( "label" in elem ) { - if ( "label" in elem.parentNode ) { - return elem.parentNode.disabled === disabled; - } else { - return elem.disabled === disabled; - } - } - - // Support: IE 6 - 11 - // Use the isDisabled shortcut property to check for disabled fieldset ancestors - return elem.isDisabled === disabled || - - // Where there is no isDisabled, check manually - /* jshint -W018 */ - elem.isDisabled !== !disabled && - disabledAncestor( elem ) === disabled; - } - - return elem.disabled === disabled; - - // Try to winnow out elements that can't be disabled before trusting the disabled property. - // Some victims get caught in our net (label, legend, menu, track), but it shouldn't - // even exist on them, let alone have a boolean value. - } else if ( "label" in elem ) { - return elem.disabled === disabled; - } - - // Remaining elements are neither :enabled nor :disabled - return false; - }; -} - /** * Returns a function to use in pseudos for positionals * @param {Function} fn @@ -1067,7 +1031,7 @@ isXML = Sizzle.isXML = function( elem ) { * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, subWindow, + var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc; // Return early if doc is invalid or already selected @@ -1082,16 +1046,14 @@ setDocument = Sizzle.setDocument = function( node ) { // Support: IE 9-11, Edge // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - if ( preferredDoc !== document && - (subWindow = document.defaultView) && subWindow.top !== subWindow ) { - - // Support: IE 11, Edge - if ( subWindow.addEventListener ) { - subWindow.addEventListener( "unload", unloadHandler, false ); + if ( (parent = document.defaultView) && parent.top !== parent ) { + // Support: IE 11 + if ( parent.addEventListener ) { + parent.addEventListener( "unload", unloadHandler, false ); // Support: IE 9 - 10 only - } else if ( subWindow.attachEvent ) { - subWindow.attachEvent( "onunload", unloadHandler ); + } else if ( parent.attachEvent ) { + parent.attachEvent( "onunload", unloadHandler ); } } @@ -1101,18 +1063,18 @@ setDocument = Sizzle.setDocument = function( node ) { // Support: IE<8 // Verify that getAttribute really returns attributes and not properties // (excepting IE8 booleans) - support.attributes = assert(function( el ) { - el.className = "i"; - return !el.getAttribute("className"); + support.attributes = assert(function( div ) { + div.className = "i"; + return !div.getAttribute("className"); }); /* getElement(s)By* ---------------------------------------------------------------------- */ // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( el ) { - el.appendChild( document.createComment("") ); - return !el.getElementsByTagName("*").length; + support.getElementsByTagName = assert(function( div ) { + div.appendChild( document.createComment("") ); + return !div.getElementsByTagName("*").length; }); // Support: IE<9 @@ -1120,28 +1082,32 @@ setDocument = Sizzle.setDocument = function( node ) { // Support: IE<10 // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, + // The broken getElementById methods don't pick up programatically-set names, // so use a roundabout getElementsByName test - support.getById = assert(function( el ) { - docElem.appendChild( el ).id = expando; + support.getById = assert(function( div ) { + docElem.appendChild( div ).id = expando; return !document.getElementsByName || !document.getElementsByName( expando ).length; }); - // ID filter and find + // ID find and filter if ( support.getById ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var m = context.getElementById( id ); + return m ? [ m ] : []; + } + }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var elem = context.getElementById( id ); - return elem ? [ elem ] : []; - } - }; } else { + // Support: IE6/7 + // getElementById is not reliable as a find shortcut + delete Expr.find["ID"]; + Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { @@ -1150,36 +1116,6 @@ setDocument = Sizzle.setDocument = function( node ) { return node && node.value === attrId; }; }; - - // Support: IE 6 - 7 only - // getElementById is not reliable as a find shortcut - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var node, i, elems, - elem = context.getElementById( id ); - - if ( elem ) { - - // Verify the id attribute - node = elem.getAttributeNode("id"); - if ( node && node.value === id ) { - return [ elem ]; - } - - // Fall back on getElementsByName - elems = context.getElementsByName( id ); - i = 0; - while ( (elem = elems[i++]) ) { - node = elem.getAttributeNode("id"); - if ( node && node.value === id ) { - return [ elem ]; - } - } - } - - return []; - } - }; } // Tag @@ -1233,87 +1169,77 @@ setDocument = Sizzle.setDocument = function( node ) { // We allow this because of a bug in IE8/9 that throws an error // whenever `document.activeElement` is accessed on an iframe // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See https://bugs.jquery.com/ticket/13378 + // See http://bugs.jquery.com/ticket/13378 rbuggyQSA = []; if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { // Build QSA regex // Regex strategy adopted from Diego Perini - assert(function( el ) { + assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explicitly // setting a boolean content attribute, // since its presence should be enough - // https://bugs.jquery.com/ticket/12359 - docElem.appendChild( el ).innerHTML = "" + + // http://bugs.jquery.com/ticket/12359 + docElem.appendChild( div ).innerHTML = "" + ""; // Support: IE8, Opera 11-12.16 // Nothing should be selected when empty strings follow ^= or $= or *= // The test attribute must be unknown in Opera but "safe" for WinRT - // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( el.querySelectorAll("[msallowcapture^='']").length ) { + // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( div.querySelectorAll("[msallowcapture^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } // Support: IE8 // Boolean attributes and "value" are not treated correctly - if ( !el.querySelectorAll("[selected]").length ) { + if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { rbuggyQSA.push("~="); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests - if ( !el.querySelectorAll(":checked").length ) { + if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } // Support: Safari 8+, iOS 8+ // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { + // In-page `selector#id sibing-combinator selector` fails + if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { rbuggyQSA.push(".#.+[+~]"); } }); - assert(function( el ) { - el.innerHTML = "" + - ""; - + assert(function( div ) { // Support: Windows 8 Native Apps // The type and name attributes are restricted during .innerHTML assignment var input = document.createElement("input"); input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); + div.appendChild( input ).setAttribute( "name", "D" ); // Support: IE8 // Enforce case-sensitivity of name attribute - if ( el.querySelectorAll("[name=d]").length ) { + if ( div.querySelectorAll("[name=d]").length ) { rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests - if ( el.querySelectorAll(":enabled").length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: IE9-11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - docElem.appendChild( el ).disabled = true; - if ( el.querySelectorAll(":disabled").length !== 2 ) { + if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos - el.querySelectorAll("*,:x"); + div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } @@ -1324,14 +1250,14 @@ setDocument = Sizzle.setDocument = function( node ) { docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { - assert(function( el ) { + assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( el, "*" ); + support.disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead - matches.call( el, "[s!='']:x" ); + matches.call( div, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } @@ -1533,10 +1459,6 @@ Sizzle.attr = function( elem, name ) { null; }; -Sizzle.escape = function( sel ) { - return (sel + "").replace( rcssescape, fcssescape ); -}; - Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; @@ -2004,8 +1926,13 @@ Expr = Sizzle.selectors = { }, // Boolean properties - "enabled": createDisabledPseudo( false ), - "disabled": createDisabledPseudo( true ), + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements @@ -2207,9 +2134,7 @@ function toSelector( tokens ) { function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, - skip = combinator.next, - key = skip || dir, - checkNonElements = base && key === "parentNode", + checkNonElements = base && dir === "parentNode", doneName = done++; return combinator.first ? @@ -2220,7 +2145,6 @@ function addCombinator( matcher, combinator, base ) { return matcher( elem, context, xml ); } } - return false; } : // Check against all ancestor/preceding elements @@ -2246,16 +2170,14 @@ function addCombinator( matcher, combinator, base ) { // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); - if ( skip && skip === elem.nodeName.toLowerCase() ) { - elem = elem[ dir ] || elem; - } else if ( (oldCache = uniqueCache[ key ]) && + if ( (oldCache = uniqueCache[ dir ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements return (newCache[ 2 ] = oldCache[ 2 ]); } else { // Reuse newcache so results back-propagate to previous elements - uniqueCache[ key ] = newCache; + uniqueCache[ dir ] = newCache; // A match means we're done; a fail means we have to keep checking if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { @@ -2265,7 +2187,6 @@ function addCombinator( matcher, combinator, base ) { } } } - return false; }; } @@ -2628,7 +2549,8 @@ select = Sizzle.select = function( selector, context, results, seed ) { // Reduce context if the leading compound selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { @@ -2698,17 +2620,17 @@ setDocument(); // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) // Detached nodes confoundingly follow *each other* -support.sortDetached = assert(function( el ) { +support.sortDetached = assert(function( div1 ) { // Should return 1, but returns 4 (following) - return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; + return div1.compareDocumentPosition( document.createElement("div") ) & 1; }); // Support: IE<8 // Prevent attribute/property "interpolation" -// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert(function( el ) { - el.innerHTML = ""; - return el.firstChild.getAttribute("href") === "#" ; +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( div ) { + div.innerHTML = ""; + return div.firstChild.getAttribute("href") === "#" ; }) ) { addHandle( "type|href|height|width", function( elem, name, isXML ) { if ( !isXML ) { @@ -2719,10 +2641,10 @@ if ( !assert(function( el ) { // Support: IE<9 // Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert(function( el ) { - el.innerHTML = ""; - el.firstChild.setAttribute( "value", "" ); - return el.firstChild.getAttribute( "value" ) === ""; +if ( !support.attributes || !assert(function( div ) { + div.innerHTML = ""; + div.firstChild.setAttribute( "value", "" ); + return div.firstChild.getAttribute( "value" ) === ""; }) ) { addHandle( "value", function( elem, name, isXML ) { if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { @@ -2733,8 +2655,8 @@ if ( !support.attributes || !assert(function( el ) { // Support: IE<9 // Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert(function( el ) { - return el.getAttribute("disabled") == null; +if ( !assert(function( div ) { + return div.getAttribute("disabled") == null; }) ) { addHandle( booleans, function( elem, name, isXML ) { var val; @@ -2755,15 +2677,11 @@ return Sizzle; jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; - -// Deprecated jQuery.expr[ ":" ] = jQuery.expr.pseudos; jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; -jQuery.escapeSelector = Sizzle.escape; - @@ -2798,41 +2716,40 @@ var siblings = function( n, elem ) { var rneedsContext = jQuery.expr.match.needsContext; +var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); -function nodeName( elem, name ) { - - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - -}; -var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); - +var risSimple = /^.[^:#\[\.,]*$/; // Implement the identical functionality for filter and not function winnow( elements, qualifier, not ) { - if ( isFunction( qualifier ) ) { + if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { + /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; } ); + } - // Single element if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; } ); + } - // Arraylike of elements (jQuery, arguments, Array) - if ( typeof qualifier !== "string" ) { - return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not; - } ); + if ( typeof qualifier === "string" ) { + if ( risSimple.test( qualifier ) ) { + return jQuery.filter( qualifier, elements, not ); + } + + qualifier = jQuery.filter( qualifier, elements ); } - // Filtered directly for both simple and complex selectors - return jQuery.filter( qualifier, elements, not ); + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not; + } ); } jQuery.filter = function( expr, elems, not ) { @@ -2842,19 +2759,18 @@ jQuery.filter = function( expr, elems, not ) { expr = ":not(" + expr + ")"; } - if ( elems.length === 1 && elem.nodeType === 1 ) { - return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; - } - - return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - } ) ); + return elems.length === 1 && elem.nodeType === 1 ? + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + } ) ); }; jQuery.fn.extend( { find: function( selector ) { - var i, ret, + var i, len = this.length, + ret = [], self = this; if ( typeof selector !== "string" ) { @@ -2867,13 +2783,14 @@ jQuery.fn.extend( { } ) ); } - ret = this.pushStack( [] ); - for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } - return len > 1 ? jQuery.uniqueSort( ret ) : ret; + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = this.selector ? this.selector + " " + selector : selector; + return ret; }, filter: function( selector ) { return this.pushStack( winnow( this, selector || [], false ) ); @@ -2905,8 +2822,7 @@ var rootjQuery, // A simple way to check for HTML strings // Prioritize #id over 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; @@ -2953,7 +2869,7 @@ var rootjQuery, for ( match in context ) { // Properties of context are called as methods if possible - if ( isFunction( this[ match ] ) ) { + if ( jQuery.isFunction( this[ match ] ) ) { this[ match ]( context[ match ] ); // ...and otherwise set as attributes @@ -2969,12 +2885,17 @@ var rootjQuery, } else { elem = document.getElementById( match[ 2 ] ); - if ( elem ) { + // Support: Blackberry 4.6 + // gEBID returns nodes no longer in the document (#6963) + if ( elem && elem.parentNode ) { // Inject the element directly into the jQuery object - this[ 0 ] = elem; this.length = 1; + this[ 0 ] = elem; } + + this.context = document; + this.selector = selector; return this; } @@ -2990,13 +2911,13 @@ 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 ( isFunction( selector ) ) { + } else if ( jQuery.isFunction( selector ) ) { return root.ready !== undefined ? root.ready( selector ) : @@ -3004,6 +2925,11 @@ var rootjQuery, selector( jQuery ); } + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + return jQuery.makeArray( selector, this ); }; @@ -3044,24 +2970,23 @@ jQuery.fn.extend( { i = 0, l = this.length, matched = [], - targets = typeof selectors !== "string" && jQuery( selectors ); + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; - // Positional selectors never match, since there's no _selection_ context - if ( !rneedsContext.test( selectors ) ) { - for ( ; i < l; i++ ) { - for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { + for ( ; i < l; i++ ) { + for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { - // Always skip document fragments - if ( cur.nodeType < 11 && ( targets ? - targets.index( cur ) > -1 : + // Always skip document fragments + if ( cur.nodeType < 11 && ( pos ? + pos.index( cur ) > -1 : - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector( cur, selectors ) ) ) { + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector( cur, selectors ) ) ) { - matched.push( cur ); - break; - } + matched.push( cur ); + break; } } } @@ -3146,18 +3071,7 @@ jQuery.each( { return siblings( elem.firstChild ); }, contents: function( elem ) { - if ( nodeName( elem, "iframe" ) ) { - return elem.contentDocument; - } - - // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only - // Treat the template element as a regular one in browsers that - // don't support it. - if ( nodeName( elem, "template" ) ) { - elem = elem.content || elem; - } - - return jQuery.merge( [], elem.childNodes ); + return elem.contentDocument || jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { @@ -3187,14 +3101,14 @@ jQuery.each( { return this.pushStack( matched ); }; } ); -var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); +var rnotwhite = ( /\S+/g ); // Convert String-formatted options into Object-formatted ones function createOptions( options ) { var object = {}; - jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { + jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; } ); return object; @@ -3255,7 +3169,7 @@ jQuery.Callbacks = function( options ) { fire = function() { // Enforce single-firing - locked = locked || options.once; + locked = options.once; // Execute callbacks for all pending executions, // respecting firingIndex overrides and runtime changes @@ -3311,11 +3225,11 @@ jQuery.Callbacks = function( options ) { ( function add( args ) { jQuery.each( args, function( _, arg ) { - if ( isFunction( arg ) ) { + if ( jQuery.isFunction( arg ) ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } - } else if ( arg && arg.length && toType( arg ) !== "string" ) { + } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { // Inspect recursively add( arg ); @@ -3379,7 +3293,7 @@ jQuery.Callbacks = function( options ) { // Abort any pending executions lock: function() { locked = queue = []; - if ( !memory && !firing ) { + if ( !memory ) { list = memory = ""; } return this; @@ -3417,59 +3331,15 @@ jQuery.Callbacks = function( options ) { }; -function Identity( v ) { - return v; -} -function Thrower( ex ) { - throw ex; -} - -function adoptValue( value, resolve, reject, noValue ) { - var method; - - try { - - // Check for promise aspect first to privilege synchronous behavior - if ( value && isFunction( ( method = value.promise ) ) ) { - method.call( value ).done( resolve ).fail( reject ); - - // Other thenables - } else if ( value && isFunction( ( method = value.then ) ) ) { - method.call( value, resolve, reject ); - - // Other non-thenables - } else { - - // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: - // * false: [ value ].slice( 0 ) => resolve( value ) - // * true: [ value ].slice( 1 ) => resolve() - resolve.apply( undefined, [ value ].slice( noValue ) ); - } - - // For Promises/A+, convert exceptions into rejections - // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in - // Deferred#then to conditionally suppress rejection. - } catch ( value ) { - - // Support: Android 4.0 only - // Strict mode functions invoked without .call/.apply get global-object context - reject.apply( undefined, [ value ] ); - } -} - jQuery.extend( { Deferred: function( func ) { var tuples = [ - // action, add listener, callbacks, - // ... .then handlers, argument index, [final state] - [ "notify", "progress", jQuery.Callbacks( "memory" ), - jQuery.Callbacks( "memory" ), 2 ], - [ "resolve", "done", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 0, "resolved" ], - [ "reject", "fail", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 1, "rejected" ] + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ], + [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ], + [ "notify", "progress", jQuery.Callbacks( "memory" ) ] ], state = "pending", promise = { @@ -3480,33 +3350,23 @@ jQuery.extend( { deferred.done( arguments ).fail( arguments ); return this; }, - "catch": function( fn ) { - return promise.then( null, fn ); - }, - - // Keep pipe for back-compat - pipe: function( /* fnDone, fnFail, fnProgress */ ) { + then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; - return jQuery.Deferred( function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { + var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // Map tuples (progress, done, fail) to arguments (done, fail, progress) - var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; - - // deferred.progress(function() { bind to newDefer or newDefer.notify }) - // deferred.done(function() { bind to newDefer or newDefer.resolve }) - // deferred.fail(function() { bind to newDefer or newDefer.reject }) + // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[ 1 ] ]( function() { var returned = fn && fn.apply( this, arguments ); - if ( returned && isFunction( returned.promise ) ) { + if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .progress( newDefer.notify ) .done( newDefer.resolve ) .fail( newDefer.reject ); } else { newDefer[ tuple[ 0 ] + "With" ]( - this, + this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); } @@ -3515,170 +3375,6 @@ jQuery.extend( { fns = null; } ).promise(); }, - then: function( onFulfilled, onRejected, onProgress ) { - var maxDepth = 0; - function resolve( depth, deferred, handler, special ) { - return function() { - var that = this, - args = arguments, - mightThrow = function() { - var returned, then; - - // Support: Promises/A+ section 2.3.3.3.3 - // https://promisesaplus.com/#point-59 - // Ignore double-resolution attempts - if ( depth < maxDepth ) { - return; - } - - returned = handler.apply( that, args ); - - // Support: Promises/A+ section 2.3.1 - // https://promisesaplus.com/#point-48 - if ( returned === deferred.promise() ) { - throw new TypeError( "Thenable self-resolution" ); - } - - // Support: Promises/A+ sections 2.3.3.1, 3.5 - // https://promisesaplus.com/#point-54 - // https://promisesaplus.com/#point-75 - // Retrieve `then` only once - then = returned && - - // Support: Promises/A+ section 2.3.4 - // https://promisesaplus.com/#point-64 - // Only check objects and functions for thenability - ( typeof returned === "object" || - typeof returned === "function" ) && - returned.then; - - // Handle a returned thenable - if ( isFunction( then ) ) { - - // Special processors (notify) just wait for resolution - if ( special ) { - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ) - ); - - // Normal processors (resolve) also hook into progress - } else { - - // ...and disregard older resolution values - maxDepth++; - - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ), - resolve( maxDepth, deferred, Identity, - deferred.notifyWith ) - ); - } - - // Handle all other returned values - } else { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Identity ) { - that = undefined; - args = [ returned ]; - } - - // Process the value(s) - // Default process is resolve - ( special || deferred.resolveWith )( that, args ); - } - }, - - // Only normal processors (resolve) catch and reject exceptions - process = special ? - mightThrow : - function() { - try { - mightThrow(); - } catch ( e ) { - - if ( jQuery.Deferred.exceptionHook ) { - jQuery.Deferred.exceptionHook( e, - process.stackTrace ); - } - - // Support: Promises/A+ section 2.3.3.3.4.1 - // https://promisesaplus.com/#point-61 - // Ignore post-resolution exceptions - if ( depth + 1 >= maxDepth ) { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Thrower ) { - that = undefined; - args = [ e ]; - } - - deferred.rejectWith( that, args ); - } - } - }; - - // Support: Promises/A+ section 2.3.3.3.1 - // https://promisesaplus.com/#point-57 - // Re-resolve promises immediately to dodge false rejection from - // subsequent errors - if ( depth ) { - process(); - } else { - - // Call an optional hook to record the stack, in case of exception - // since it's otherwise lost when execution goes async - if ( jQuery.Deferred.getStackHook ) { - process.stackTrace = jQuery.Deferred.getStackHook(); - } - window.setTimeout( process ); - } - }; - } - - return jQuery.Deferred( function( newDefer ) { - - // progress_handlers.add( ... ) - tuples[ 0 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onProgress ) ? - onProgress : - Identity, - newDefer.notifyWith - ) - ); - - // fulfilled_handlers.add( ... ) - tuples[ 1 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onFulfilled ) ? - onFulfilled : - Identity - ) - ); - - // rejected_handlers.add( ... ) - tuples[ 2 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onRejected ) ? - onRejected : - Thrower - ) - ); - } ).promise(); - }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object @@ -3688,58 +3384,33 @@ jQuery.extend( { }, deferred = {}; + // Keep pipe for back-compat + promise.pipe = promise.then; + // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], - stateString = tuple[ 5 ]; + stateString = tuple[ 3 ]; - // promise.progress = list.add - // promise.done = list.add - // promise.fail = list.add + // promise[ done | fail | progress ] = list.add promise[ tuple[ 1 ] ] = list.add; // Handle state if ( stateString ) { - list.add( - function() { + list.add( function() { - // state = "resolved" (i.e., fulfilled) - // state = "rejected" - state = stateString; - }, + // state = [ resolved | rejected ] + state = stateString; - // rejected_callbacks.disable - // fulfilled_callbacks.disable - tuples[ 3 - i ][ 2 ].disable, - - // rejected_handlers.disable - // fulfilled_handlers.disable - tuples[ 3 - i ][ 3 ].disable, - - // progress_callbacks.lock - tuples[ 0 ][ 2 ].lock, - - // progress_handlers.lock - tuples[ 0 ][ 3 ].lock - ); + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } - // progress_handlers.fire - // fulfilled_handlers.fire - // rejected_handlers.fire - list.add( tuple[ 3 ].fire ); - - // deferred.notify = function() { deferred.notifyWith(...) } - // deferred.resolve = function() { deferred.resolveWith(...) } - // deferred.reject = function() { deferred.rejectWith(...) } + // deferred[ resolve | reject | notify ] deferred[ tuple[ 0 ] ] = function() { - deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); + deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments ); return this; }; - - // deferred.notifyWith = list.fireWith - // deferred.resolveWith = list.fireWith - // deferred.rejectWith = list.fireWith deferred[ tuple[ 0 ] + "With" ] = list.fireWith; } ); @@ -3756,95 +3427,68 @@ jQuery.extend( { }, // Deferred helper - when: function( singleValue ) { - var - - // count of uncompleted subordinates - remaining = arguments.length, - - // count of unprocessed arguments - i = remaining, - - // subordinate fulfillment data - resolveContexts = Array( i ), + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, resolveValues = slice.call( arguments ), + length = resolveValues.length, - // the master Deferred - master = jQuery.Deferred(), + // the count of uncompleted subordinates + remaining = length !== 1 || + ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - // subordinate callback factory - updateFunc = function( i ) { + // the master Deferred. + // If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { return function( value ) { - resolveContexts[ i ] = this; - resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( !( --remaining ) ) { - master.resolveWith( resolveContexts, resolveValues ); + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); } }; - }; + }, - // Single- and empty arguments are adopted like Promise.resolve - if ( remaining <= 1 ) { - adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, - !remaining ); + progressValues, progressContexts, resolveContexts; - // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( master.state() === "pending" || - isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { - - return master.then(); + // Add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .progress( updateFunc( i, progressContexts, progressValues ) ) + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ); + } else { + --remaining; + } } } - // Multiple arguments are aggregated like Promise.all array elements - while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); + // If we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); } - return master.promise(); + return deferred.promise(); } } ); -// These usually indicate a programmer mistake during development, -// warn about them ASAP rather than swallowing them by default. -var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; - -jQuery.Deferred.exceptionHook = function( error, stack ) { - - // Support: IE 8 - 9 only - // Console exists when dev tools are open, which can happen at any time - if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { - window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); - } -}; - - - - -jQuery.readyException = function( error ) { - window.setTimeout( function() { - throw error; - } ); -}; - - - - // The deferred used on DOM ready -var readyList = jQuery.Deferred(); +var readyList; jQuery.fn.ready = function( fn ) { - readyList - .then( fn ) - - // Wrap jQuery.readyException in a function so that the lookup - // happens at the time of error handling instead of callback - // registration. - .catch( function( error ) { - jQuery.readyException( error ); - } ); + // Add the callback + jQuery.ready.promise().done( fn ); return this; }; @@ -3858,6 +3502,15 @@ jQuery.extend( { // the ready event fires. See #6781 readyWait: 1, + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + // Handle when the DOM is ready ready: function( wait ) { @@ -3876,36 +3529,53 @@ 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" ); + } } } ); -jQuery.ready.then = readyList.then; - -// The ready event handler and self cleanup method +/** + * The ready event handler and self cleanup method + */ function completed() { document.removeEventListener( "DOMContentLoaded", completed ); window.removeEventListener( "load", completed ); jQuery.ready(); } -// Catch cases where $(document).ready() is called -// after the browser event has already occurred. -// Support: IE <=9 - 10 only -// Older IE sometimes signals "interactive" too soon -if ( document.readyState === "complete" || - ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - window.setTimeout( jQuery.ready ); + readyList = jQuery.Deferred(); -} else { + // Catch cases where $(document).ready() is called + // after the browser event has already occurred. + // Support: IE9-10 only + // Older IE sometimes signals "interactive" too soon + if ( document.readyState === "complete" || + ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed ); + // Handle it asynchronously to allow scripts the opportunity to delay ready + window.setTimeout( jQuery.ready ); - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed ); -} + } else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed ); + } + } + return readyList.promise( obj ); +}; + +// Kick off the DOM ready check even if the user does not +jQuery.ready.promise(); @@ -3918,7 +3588,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { bulk = key == null; // Sets many values - if ( toType( key ) === "object" ) { + if ( jQuery.type( key ) === "object" ) { chainable = true; for ( i in key ) { access( elems, fn, i, key[ i ], true, emptyGet, raw ); @@ -3928,7 +3598,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { } else if ( value !== undefined ) { chainable = true; - if ( !isFunction( value ) ) { + if ( !jQuery.isFunction( value ) ) { raw = true; } @@ -3959,34 +3629,14 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { } } - if ( chainable ) { - return elems; - } + return chainable ? + elems : - // Gets - if ( bulk ) { - return fn.call( elems ); - } - - return len ? fn( elems[ 0 ], key ) : emptyGet; + // Gets + bulk ? + fn.call( elems ) : + len ? fn( elems[ 0 ], key ) : emptyGet; }; - - -// Matches dashed string for camelizing -var rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g; - -// Used by camelCase as callback to replace() -function fcamelCase( all, letter ) { - return letter.toUpperCase(); -} - -// Convert dashed to camelCase; used by the css and data modules -// Support: IE <=9 - 11, Edge 12 - 15 -// Microsoft forgot to hump their vendor prefix (#9572) -function camelCase( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); -} var acceptData = function( owner ) { // Accepts only: @@ -3995,6 +3645,7 @@ var acceptData = function( owner ) { // - Node.DOCUMENT_NODE // - Object // - Any + /* jshint -W018 */ return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); }; @@ -4009,8 +3660,35 @@ Data.uid = 1; Data.prototype = { + register: function( owner, initial ) { + var value = initial || {}; + + // If it is a node unlikely to be stringify-ed or looped over + // use plain assignment + if ( owner.nodeType ) { + owner[ this.expando ] = value; + + // Otherwise secure it in a non-enumerable, non-writable property + // configurability must be true to allow the property to be + // deleted with the delete operator + } else { + Object.defineProperty( owner, this.expando, { + value: value, + writable: true, + configurable: true + } ); + } + return owner[ this.expando ]; + }, cache: function( owner ) { + // We can accept data for non-element nodes in modern browsers, + // but we should not, see #8335. + // Always return an empty object. + if ( !acceptData( owner ) ) { + return {}; + } + // Check if the owner object already has a cache var value = owner[ this.expando ]; @@ -4047,16 +3725,15 @@ Data.prototype = { cache = this.cache( owner ); // Handle: [ owner, key, value ] args - // Always use camelCase key (gh-2257) if ( typeof data === "string" ) { - cache[ camelCase( data ) ] = value; + cache[ data ] = value; // Handle: [ owner, { properties } ] args } else { // Copy the properties one-by-one to the cache object for ( prop in data ) { - cache[ camelCase( prop ) ] = data[ prop ]; + cache[ prop ] = data[ prop ]; } } return cache; @@ -4064,11 +3741,10 @@ Data.prototype = { get: function( owner, key ) { return key === undefined ? this.cache( owner ) : - - // Always use camelCase key (gh-2257) - owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; + owner[ this.expando ] && owner[ this.expando ][ key ]; }, access: function( owner, key, value ) { + var stored; // In cases where either: // @@ -4084,7 +3760,10 @@ Data.prototype = { if ( key === undefined || ( ( key && typeof key === "string" ) && value === undefined ) ) { - return this.get( owner, key ); + stored = this.get( owner, key ); + + return stored !== undefined ? + stored : this.get( owner, jQuery.camelCase( key ) ); } // When the key is not a string, or both a key and value @@ -4100,45 +3779,58 @@ Data.prototype = { return value !== undefined ? value : key; }, remove: function( owner, key ) { - var i, + var i, name, camel, cache = owner[ this.expando ]; if ( cache === undefined ) { return; } - if ( key !== undefined ) { + if ( key === undefined ) { + this.register( owner ); + + } else { // Support array or space separated string of keys - if ( Array.isArray( key ) ) { + if ( jQuery.isArray( key ) ) { - // If key is an array of keys... - // We always set camelCase keys, so remove that. - key = key.map( camelCase ); + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = key.concat( key.map( jQuery.camelCase ) ); } else { - key = camelCase( key ); + camel = jQuery.camelCase( key ); - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - key = key in cache ? - [ key ] : - ( key.match( rnothtmlwhite ) || [] ); + // Try the string as a key before any manipulation + if ( key in cache ) { + name = [ key, camel ]; + } else { + + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + name = camel; + name = name in cache ? + [ name ] : ( name.match( rnotwhite ) || [] ); + } } - i = key.length; + i = name.length; while ( i-- ) { - delete cache[ key[ i ] ]; + delete cache[ name[ i ] ]; } } // Remove the expando if there's no more data if ( key === undefined || jQuery.isEmptyObject( cache ) ) { - // Support: Chrome <=35 - 45 + // Support: Chrome <= 35-45+ // Webkit & Blink performance suffers when deleting properties // from DOM nodes, so set to undefined instead - // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) + // https://code.google.com/p/chromium/issues/detail?id=378607 if ( owner.nodeType ) { owner[ this.expando ] = undefined; } else { @@ -4170,31 +3862,6 @@ var dataUser = new Data(); var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g; -function getData( data ) { - if ( data === "true" ) { - return true; - } - - if ( data === "false" ) { - return false; - } - - if ( data === "null" ) { - return null; - } - - // Only convert to a number if it doesn't change the string - if ( data === +data + "" ) { - return +data; - } - - if ( rbrace.test( data ) ) { - return JSON.parse( data ); - } - - return data; -} - function dataAttr( elem, key, data ) { var name; @@ -4206,7 +3873,14 @@ function dataAttr( elem, key, data ) { if ( typeof data === "string" ) { try { - data = getData( data ); + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; } catch ( e ) {} // Make sure we set the data so it isn't changed later @@ -4257,12 +3931,12 @@ jQuery.fn.extend( { i = attrs.length; while ( i-- ) { - // Support: IE 11 only + // Support: IE11+ // The attrs elements can be null (#14894) if ( attrs[ i ] ) { name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { - name = camelCase( name.slice( 5 ) ); + name = jQuery.camelCase( name.slice( 5 ) ); dataAttr( elem, name, data[ name ] ); } } @@ -4282,7 +3956,7 @@ jQuery.fn.extend( { } return access( this, function( value ) { - var data; + var data, camelKey; // The calling jQuery object (element matches) is not empty // (and therefore has an element appears at this[ 0 ]) and the @@ -4292,15 +3966,29 @@ jQuery.fn.extend( { if ( elem && value === undefined ) { // Attempt to get data from the cache - // The key will always be camelCased in Data - data = dataUser.get( elem, key ); + // with the key as-is + data = dataUser.get( elem, key ) || + + // Try to find dashed key if it exists (gh-2779) + // This is for 2.2.x only + dataUser.get( elem, key.replace( rmultiDash, "-$&" ).toLowerCase() ); + + if ( data !== undefined ) { + return data; + } + + camelKey = jQuery.camelCase( key ); + + // Attempt to get data from the cache + // with the key camelized + data = dataUser.get( elem, camelKey ); if ( data !== undefined ) { return data; } // Attempt to "discover" the data in // HTML5 custom data-* attrs - data = dataAttr( elem, key ); + data = dataAttr( elem, camelKey, undefined ); if ( data !== undefined ) { return data; } @@ -4310,10 +3998,24 @@ jQuery.fn.extend( { } // Set the data... + camelKey = jQuery.camelCase( key ); this.each( function() { - // We always store the camelCased key - dataUser.set( this, key, value ); + // First, attempt to store a copy or reference of any + // data that might've been store with a camelCased key. + var data = dataUser.get( this, camelKey ); + + // For HTML5 data-* attribute interop, we have to + // store property names with dashes in a camelCase form. + // This might not apply to all properties...* + dataUser.set( this, camelKey, value ); + + // *... In the case of properties that might _actually_ + // have dashes, we need to also store a copy of that + // unchanged property. + if ( key.indexOf( "-" ) > -1 && data !== undefined ) { + dataUser.set( this, key, value ); + } } ); }, null, value, arguments.length > 1, null, true ); }, @@ -4336,7 +4038,7 @@ jQuery.extend( { // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { - if ( !queue || Array.isArray( data ) ) { + if ( !queue || jQuery.isArray( data ) ) { queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); } else { queue.push( data ); @@ -4466,58 +4168,24 @@ var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; -var isHiddenWithinTree = function( elem, el ) { +var isHidden = function( elem, el ) { - // isHiddenWithinTree might be called from jQuery#filter function; + // isHidden might be called from jQuery#filter function; // in that case, element will be second argument elem = el || elem; - - // Inline style trumps all - return elem.style.display === "none" || - elem.style.display === "" && - - // Otherwise, check computed style - // Support: Firefox <=43 - 45 - // Disconnected elements can have computed display: none, so first confirm that elem is - // in the document. - jQuery.contains( elem.ownerDocument, elem ) && - - jQuery.css( elem, "display" ) === "none"; + return jQuery.css( elem, "display" ) === "none" || + !jQuery.contains( elem.ownerDocument, elem ); }; -var swap = function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; -}; - - function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, scale, + var adjusted, + scale = 1, maxIterations = 20, currentValue = tween ? - function() { - return tween.cur(); - } : - function() { - return jQuery.css( elem, prop, "" ); - }, + function() { return tween.cur(); } : + function() { return jQuery.css( elem, prop, "" ); }, initial = currentValue(), unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), @@ -4527,33 +4195,30 @@ function adjustCSS( elem, prop, valueParts, tween ) { if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { - // Support: Firefox <=54 - // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) - initial = initial / 2; - // Trust units reported by jQuery.css unit = unit || initialInUnit[ 3 ]; + // Make sure we update the tween properties later on + valueParts = valueParts || []; + // Iteratively approximate from a nonzero starting point initialInUnit = +initial || 1; - while ( maxIterations-- ) { + do { - // Evaluate and update our best guess (doubling guesses that zero out). - // Finish if the scale equals or crosses 1 (making the old*new product non-positive). - jQuery.style( elem, prop, initialInUnit + unit ); - if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { - maxIterations = 0; - } + // If previous iteration zeroed out, double until we get *something*. + // Use string for doubling so we don't accidentally see scale as unchanged below + scale = scale || ".5"; + + // Adjust and apply initialInUnit = initialInUnit / scale; + jQuery.style( elem, prop, initialInUnit + unit ); - } - - initialInUnit = initialInUnit * 2; - jQuery.style( elem, prop, initialInUnit + unit ); - - // Make sure we update the tween properties later on - valueParts = valueParts || []; + // Update scale, tolerating zero or NaN from tween.cur() + // Break the loop if scale is unchanged or perfect, or if we've just had enough. + } while ( + scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations + ); } if ( valueParts ) { @@ -4571,114 +4236,18 @@ function adjustCSS( elem, prop, valueParts, tween ) { } return adjusted; } - - -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 ) { - var display, elem, - values = [], - index = 0, - length = elements.length; - - // Determine new display value for elements that need to change - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - 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 === "" && isHiddenWithinTree( elem ) ) { - values[ index ] = getDefaultDisplay( elem ); - } - } else { - if ( display !== "none" ) { - values[ index ] = "none"; - - // Remember what we're overwriting - dataPriv.set( elem, "display", display ); - } - } - } - - // Set the display of the elements in a second loop to avoid constant reflow - for ( index = 0; index < length; index++ ) { - if ( values[ index ] != null ) { - elements[ index ].style.display = values[ index ]; - } - } - - 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 ( isHiddenWithinTree( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - } ); - } -} ); var rcheckableType = ( /^(?:checkbox|radio)$/i ); -var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); +var rtagName = ( /<([\w:-]+)/ ); -var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); +var rscriptType = ( /^$|\/(?:java|ecma)script/i ); // We have to close these tags to support XHTML (#13200) var wrapMap = { - // Support: IE <=9 only + // Support: IE9 option: [ 1, "" ], // XHTML parsers do not magically insert elements in the @@ -4692,7 +4261,7 @@ var wrapMap = { _default: [ 0, "", "" ] }; -// Support: IE <=9 only +// Support: IE9 wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; @@ -4701,25 +4270,17 @@ wrapMap.th = wrapMap.td; function getAll( context, tag ) { - // Support: IE <=9 - 11 only + // Support: IE9-11+ // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret; + var ret = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== "undefined" ? + context.querySelectorAll( tag || "*" ) : + []; - if ( typeof context.getElementsByTagName !== "undefined" ) { - ret = context.getElementsByTagName( tag || "*" ); - - } else if ( typeof context.querySelectorAll !== "undefined" ) { - ret = context.querySelectorAll( tag || "*" ); - - } else { - ret = []; - } - - if ( tag === undefined || tag && nodeName( context, tag ) ) { - return jQuery.merge( [ context ], ret ); - } - - return ret; + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], ret ) : + ret; } @@ -4753,9 +4314,9 @@ function buildFragment( elems, context, scripts, selection, ignored ) { if ( elem || elem === 0 ) { // Add nodes directly - if ( toType( elem ) === "object" ) { + if ( jQuery.type( elem ) === "object" ) { - // Support: Android <=4.0 only, PhantomJS 1 only + // Support: Android<4.1, PhantomJS<2 // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); @@ -4778,7 +4339,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) { tmp = tmp.lastChild; } - // Support: Android <=4.0 only, PhantomJS 1 only + // Support: Android<4.1, PhantomJS<2 // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( nodes, tmp.childNodes ); @@ -4835,7 +4396,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) { div = fragment.appendChild( document.createElement( "div" ) ), input = document.createElement( "input" ); - // Support: Android 4.0 - 4.3 only + // Support: Android 4.0-4.3, Safari<=5.1 // Check state lost if the name is set (#11217) // Support: Windows Web Apps (WWA) // `name` and `type` must use .setAttribute for WWA (#14901) @@ -4845,17 +4406,15 @@ function buildFragment( elems, context, scripts, selection, ignored ) { div.appendChild( input ); - // Support: Android <=4.1 only + // Support: Safari<=5.1, Android<4.2 // Older WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - // Support: IE <=11 only + // Support: IE<=11+ // Make sure textarea (and checkbox) defaultValue is properly cloned div.innerHTML = ""; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; } )(); -var documentElement = document.documentElement; - var @@ -4871,7 +4430,7 @@ function returnFalse() { return false; } -// Support: IE <=9 only +// Support: IE9 // See #13393 for more info function safeActiveElement() { try { @@ -4920,7 +4479,7 @@ function on( elem, types, selector, data, fn, one ) { if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { - return elem; + return this; } if ( one === 1 ) { @@ -4967,12 +4526,6 @@ jQuery.event = { selector = handleObjIn.selector; } - // Ensure that invalid selectors throw exceptions at attach time - // Evaluate against documentElement in case elem is a non-element node (e.g., document) - if ( selector ) { - jQuery.find.matchesSelector( documentElement, selector ); - } - // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; @@ -4993,7 +4546,7 @@ jQuery.event = { } // Handle multiple events separated by a space - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; @@ -5075,7 +4628,7 @@ jQuery.event = { } // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; @@ -5136,23 +4689,19 @@ jQuery.event = { } }, - dispatch: function( nativeEvent ) { + dispatch: function( event ) { // Make a writable jQuery.Event from the native event object - var event = jQuery.event.fix( nativeEvent ); + event = jQuery.event.fix( event ); - var i, j, ret, matched, handleObj, handlerQueue, - args = new Array( arguments.length ), + var i, j, ret, matched, handleObj, + handlerQueue = [], + args = slice.call( arguments ), handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[ 0 ] = event; - - for ( i = 1; i < arguments.length; i++ ) { - args[ i ] = arguments[ i ]; - } - event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired @@ -5201,95 +4750,146 @@ jQuery.event = { }, handlers: function( event, handlers ) { - var i, handleObj, sel, matchedHandlers, matchedSelectors, + var i, matches, sel, handleObj, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; + // Support (at least): Chrome, IE9 // Find delegate handlers - if ( delegateCount && - - // Support: IE <=9 - // Black-hole SVG instance trees (trac-13180) - cur.nodeType && - - // Support: Firefox <=42 - // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) - // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click - // Support: IE 11 only - // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) - !( event.type === "click" && event.button >= 1 ) ) { + // Black-hole SVG instance trees (#13180) + // + // Support: Firefox<=42+ + // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) + if ( delegateCount && cur.nodeType && + ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { for ( ; cur !== this; cur = cur.parentNode || this ) { // Don't check non-elements (#13208) // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { - matchedHandlers = []; - matchedSelectors = {}; + if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { + matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; - if ( matchedSelectors[ sel ] === undefined ) { - matchedSelectors[ sel ] = handleObj.needsContext ? + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) > -1 : jQuery.find( sel, this, null, [ cur ] ).length; } - if ( matchedSelectors[ sel ] ) { - matchedHandlers.push( handleObj ); + if ( matches[ sel ] ) { + matches.push( handleObj ); } } - if ( matchedHandlers.length ) { - handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); + if ( matches.length ) { + handlerQueue.push( { elem: cur, handlers: matches } ); } } } } // Add the remaining (directly-bound) handlers - cur = this; if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); + handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); } return handlerQueue; }, - addProp: function( name, hook ) { - Object.defineProperty( jQuery.Event.prototype, name, { - enumerable: true, - configurable: true, + // Includes some event props shared by KeyEvent and MouseEvent + props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + + "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), - get: isFunction( hook ) ? - function() { - if ( this.originalEvent ) { - return hook( this.originalEvent ); - } - } : - function() { - if ( this.originalEvent ) { - return this.originalEvent[ name ]; - } - }, + fixHooks: {}, - set: function( value ) { - Object.defineProperty( this, name, { - enumerable: true, - configurable: true, - writable: true, - value: value - } ); + keyHooks: { + props: "char charCode key keyCode".split( " " ), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; } - } ); + + return event; + } }, - fix: function( originalEvent ) { - return originalEvent[ jQuery.expando ] ? - originalEvent : - new jQuery.Event( originalEvent ); + mouseHooks: { + props: ( "button buttons clientX clientY offsetX offsetY pageX pageY " + + "screenX screenY toElement" ).split( " " ), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - + ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - + ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: Cordova 2.5 (WebKit) (#13255) + // All events should have a target; Cordova deviceready doesn't + if ( !event.target ) { + event.target = document; + } + + // Support: Safari 6.0+, Chrome<28 + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, special: { @@ -5322,7 +4922,7 @@ jQuery.event = { // For checkbox, fire native event so checked state will be right trigger: function() { - if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { + if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { this.click(); return false; } @@ -5330,7 +4930,7 @@ jQuery.event = { // For cross-browser consistency, don't fire native .click() on links _default: function( event ) { - return nodeName( event.target, "a" ); + return jQuery.nodeName( event.target, "a" ); } }, @@ -5372,21 +4972,11 @@ jQuery.Event = function( src, props ) { this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && - // Support: Android <=2.3 only + // Support: Android<4.0 src.returnValue === false ? returnTrue : returnFalse; - // Create target properties - // Support: Safari <=6 - 7 only - // Target should not be a text node (#504, #13143) - this.target = ( src.target && src.target.nodeType === 3 ) ? - src.target.parentNode : - src.target; - - this.currentTarget = src.currentTarget; - this.relatedTarget = src.relatedTarget; - // Event type } else { this.type = src; @@ -5398,27 +4988,26 @@ jQuery.Event = function( src, props ) { } // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || Date.now(); + this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { constructor: jQuery.Event, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, - isSimulated: false, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; - if ( e && !this.isSimulated ) { + if ( e ) { e.preventDefault(); } }, @@ -5427,7 +5016,7 @@ jQuery.Event.prototype = { this.isPropagationStopped = returnTrue; - if ( e && !this.isSimulated ) { + if ( e ) { e.stopPropagation(); } }, @@ -5436,7 +5025,7 @@ jQuery.Event.prototype = { this.isImmediatePropagationStopped = returnTrue; - if ( e && !this.isSimulated ) { + if ( e ) { e.stopImmediatePropagation(); } @@ -5444,74 +5033,13 @@ jQuery.Event.prototype = { } }; -// Includes all common event props including KeyEvent and MouseEvent specific props -jQuery.each( { - altKey: true, - bubbles: true, - cancelable: true, - changedTouches: true, - ctrlKey: true, - detail: true, - eventPhase: true, - metaKey: true, - pageX: true, - pageY: true, - shiftKey: true, - view: true, - "char": true, - charCode: true, - key: true, - keyCode: true, - button: true, - buttons: true, - clientX: true, - clientY: true, - offsetX: true, - offsetY: true, - pointerId: true, - pointerType: true, - screenX: true, - screenY: true, - targetTouches: true, - toElement: true, - touches: true, - - which: function( event ) { - var button = event.button; - - // Add which for key events - if ( event.which == null && rkeyEvent.test( event.type ) ) { - return event.charCode != null ? event.charCode : event.keyCode; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { - if ( button & 1 ) { - return 1; - } - - if ( button & 2 ) { - return 3; - } - - if ( button & 4 ) { - return 2; - } - - return 0; - } - - return event.which; - } -}, jQuery.event.addProp ); - // Create mouseenter/leave events using mouseover/out and event-time checks // so that event delegation works in jQuery. // Do the same for pointerenter/pointerleave and pointerover/pointerout // // Support: Safari 7 only // Safari sends mouseenter too often; see: -// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 +// https://code.google.com/p/chromium/issues/detail?id=470258 // for the description of the bug (it existed in older Chrome versions as well). jQuery.each( { mouseenter: "mouseover", @@ -5542,7 +5070,6 @@ jQuery.each( { } ); jQuery.fn.extend( { - on: function( types, selector, data, fn ) { return on( this, types, selector, data, fn ); }, @@ -5589,29 +5116,23 @@ jQuery.fn.extend( { var + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, - /* eslint-disable max-len */ - - // See https://github.com/eslint/eslint/issues/3229 - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, - - /* eslint-enable */ - - // Support: IE <=10 - 11, Edge 12 - 13 only + // Support: IE 10-11, Edge 10240+ // In IE/Edge using regex groups here causes severe slowdowns. // See https://connect.microsoft.com/IE/feedback/details/1736512/ rnoInnerhtml = /\s*$/g; -// Prefer a tbody over its parent table for containing new rows function manipulationTarget( elem, content ) { - if ( nodeName( elem, "table" ) && - nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { + if ( jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - return jQuery( elem ).children( "tbody" )[ 0 ] || elem; + return elem.getElementsByTagName( "tbody" )[ 0 ] || elem; } return elem; @@ -5623,8 +5144,10 @@ function disableScript( elem ) { return elem; } function restoreScript( elem ) { - if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { - elem.type = elem.type.slice( 5 ); + var match = rscriptTypeMasked.exec( elem.type ); + + if ( match ) { + elem.type = match[ 1 ]; } else { elem.removeAttribute( "type" ); } @@ -5690,15 +5213,15 @@ function domManip( collection, args, callback, ignored ) { l = collection.length, iNoClone = l - 1, value = args[ 0 ], - valueIsFunction = isFunction( value ); + isFunction = jQuery.isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit - if ( valueIsFunction || + if ( isFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return collection.each( function( index ) { var self = collection.eq( index ); - if ( valueIsFunction ) { + if ( isFunction ) { args[ 0 ] = value.call( this, index, self.html() ); } domManip( self, args, callback, ignored ); @@ -5730,7 +5253,7 @@ function domManip( collection, args, callback, ignored ) { // Keep references to cloned scripts for later restoration if ( hasScripts ) { - // Support: Android <=4.0 only, PhantomJS 1 only + // Support: Android<4.1, PhantomJS<2 // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( scripts, getAll( node, "script" ) ); } @@ -5752,14 +5275,14 @@ function domManip( collection, args, callback, ignored ) { !dataPriv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { + if ( node.src ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl ) { jQuery._evalUrl( node.src ); } } else { - DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node ); + jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); } } } @@ -5805,7 +5328,7 @@ jQuery.extend( { if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); @@ -5858,13 +5381,13 @@ jQuery.extend( { } } - // Support: Chrome <=35 - 45+ + // Support: Chrome <= 35-45+ // Assign undefined instead of using delete, see Data#remove elem[ dataPriv.expando ] = undefined; } if ( elem[ dataUser.expando ] ) { - // Support: Chrome <=35 - 45+ + // Support: Chrome <= 35-45+ // Assign undefined instead of using delete, see Data#remove elem[ dataUser.expando ] = undefined; } @@ -5874,6 +5397,10 @@ jQuery.extend( { } ); jQuery.fn.extend( { + + // Keep domManip exposed until 3.0 (gh-2225) + domManip: domManip, + detach: function( selector ) { return remove( this, selector, true ); }, @@ -6031,86 +5558,124 @@ jQuery.each( { elems = i === last ? this : this.clone( true ); jQuery( insert[ i ] )[ original ]( elems ); - // Support: Android <=4.0 only, PhantomJS 1 only - // .get() because push.apply(_, arraylike) throws on ancient WebKit + // Support: QtWebKit + // .get() because push.apply(_, arraylike) throws push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; } ); + + +var iframe, + elemdisplay = { + + // Support: Firefox + // We have to pre-define these values for FF (#10227) + HTML: "block", + BODY: "block" + }; + +/** + * Retrieve the actual display of a element + * @param {String} name nodeName of the element + * @param {Object} doc Document object + */ + +// Called only from within defaultDisplay +function actualDisplay( name, doc ) { + var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + + display = jQuery.css( elem[ 0 ], "display" ); + + // We don't have any data stored on the element, + // so use "detach" method as fast way to get rid of the element + elem.detach(); + + return display; +} + +/** + * Try to determine the default display value of an element + * @param {String} nodeName + */ +function defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + + // Use the already-created iframe if possible + iframe = ( iframe || jQuery( "