diff --git a/api/api.js b/api/api.js
old mode 100755
new mode 100644
index 4a0b51eeffc..0f7133cdc55
--- a/api/api.js
+++ b/api/api.js
@@ -109,8 +109,8 @@ plugins.connectToAllDatabases().then(function() {
password_rotation: 3,
password_autocomplete: true,
robotstxt: "User-agent: *\nDisallow: /",
- dashboard_additional_headers: "X-Frame-Options:deny\nX-XSS-Protection:1; mode=block\nStrict-Transport-Security:max-age=31536000 ; includeSubDomains\nX-Content-Type-Options: nosniff",
- api_additional_headers: "X-Frame-Options:deny\nX-XSS-Protection:1; mode=block\nAccess-Control-Allow-Origin:*",
+ dashboard_additional_headers: "X-Frame-Options:deny\nX-XSS-Protection:1; mode=block\nStrict-Transport-Security:max-age=31536000; includeSubDomains; preload\nX-Content-Type-Options: nosniff",
+ api_additional_headers: "X-Frame-Options:deny\nX-XSS-Protection:1; mode=block\nStrict-Transport-Security:max-age=31536000; includeSubDomains; preload\nAccess-Control-Allow-Origin:*",
dashboard_rate_limit_window: 60,
dashboard_rate_limit_requests: 500,
proxy_hostname: "",
diff --git a/frontend/express/app.js b/frontend/express/app.js
index e706eb21fe5..912a532cf51 100644
--- a/frontend/express/app.js
+++ b/frontend/express/app.js
@@ -151,8 +151,8 @@ plugins.setConfigs("security", {
password_rotation: 3,
password_autocomplete: true,
robotstxt: "User-agent: *\nDisallow: /",
- dashboard_additional_headers: "X-Frame-Options:deny\nX-XSS-Protection:1; mode=block\nStrict-Transport-Security:max-age=31536000 ; includeSubDomains\nX-Content-Type-Options: nosniff",
- api_additional_headers: "X-Frame-Options:deny\nX-XSS-Protection:1; mode=block\nAccess-Control-Allow-Origin:*",
+ dashboard_additional_headers: "X-Frame-Options:deny\nX-XSS-Protection:1; mode=block\nStrict-Transport-Security:max-age=31536000; includeSubDomains; preload\nX-Content-Type-Options: nosniff",
+ api_additional_headers: "X-Frame-Options:deny\nX-XSS-Protection:1; mode=block\nStrict-Transport-Security:max-age=31536000; includeSubDomains; preload\nAccess-Control-Allow-Origin:*",
dashboard_rate_limit_window: 60,
dashboard_rate_limit_requests: 500
});
diff --git a/frontend/express/public/.well-known/security.txt b/frontend/express/public/.well-known/security.txt
new file mode 100644
index 00000000000..1db00744410
--- /dev/null
+++ b/frontend/express/public/.well-known/security.txt
@@ -0,0 +1,7 @@
+# If you would like to report a security issue with Countly Server, Countly SDKs
+# please get in touch via the below method
+Contact: mailto:security@count.ly
+Expires: 2025-03-14T00:00:00.000Z
+Preferred-Languages: en
+Canonical: https://securitytxt.org/.well-known/security.txt
+Policy: https://countly.com/legal/privacy-policy
\ No newline at end of file
diff --git a/frontend/express/public/javascripts/dom/jquery/jquery.js b/frontend/express/public/javascripts/dom/jquery/jquery.js
index be4f9d96b11..21896359f9e 100644
--- a/frontend/express/public/javascripts/dom/jquery/jquery.js
+++ b/frontend/express/public/javascripts/dom/jquery/jquery.js
@@ -1,15 +1,12 @@
/*!
- * jQuery JavaScript Library v3.6.0
+ * jQuery JavaScript Library v3.7.1
* https://jquery.com/
*
- * Includes Sizzle.js
- * https://sizzlejs.com/
- *
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
- * Date: 2021-03-02T17:08Z
+ * Date: 2023-08-28T13:37Z
*/
( function( global, factory ) {
@@ -23,7 +20,7 @@
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
- // See ticket #14549 for more info.
+ // See ticket trac-14549 for more info.
module.exports = global.document ?
factory( global, true ) :
function( w ) {
@@ -150,8 +147,9 @@ function toType( obj ) {
-var
- version = "3.6.0",
+var version = "3.7.1",
+
+ rhtmlSuffix = /HTML$/i,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
@@ -397,6 +395,38 @@ jQuery.extend( {
return obj;
},
+
+ // Retrieve the text value of an array of DOM nodes
+ text: function( elem ) {
+ var node,
+ ret = "",
+ i = 0,
+ nodeType = elem.nodeType;
+
+ if ( !nodeType ) {
+
+ // If no nodeType, this is expected to be an array
+ while ( ( node = elem[ i++ ] ) ) {
+
+ // Do not traverse comment nodes
+ ret += jQuery.text( node );
+ }
+ }
+ if ( nodeType === 1 || nodeType === 11 ) {
+ return elem.textContent;
+ }
+ if ( nodeType === 9 ) {
+ return elem.documentElement.textContent;
+ }
+ if ( nodeType === 3 || nodeType === 4 ) {
+ return elem.nodeValue;
+ }
+
+ // Do not include comment or processing instruction nodes
+
+ return ret;
+ },
+
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
@@ -419,6 +449,15 @@ jQuery.extend( {
return arr == null ? -1 : indexOf.call( arr, elem, i );
},
+ isXMLDoc: function( elem ) {
+ var namespace = elem && elem.namespaceURI,
+ docElem = elem && ( elem.ownerDocument || elem ).documentElement;
+
+ // Assume HTML when documentElement doesn't yet exist, such as inside
+ // document fragments.
+ return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );
+ },
+
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
merge: function( first, second ) {
@@ -520,43 +559,98 @@ function isArrayLike( obj ) {
return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
-var Sizzle =
-/*!
- * Sizzle CSS Selector Engine v2.3.6
- * https://sizzlejs.com/
- *
- * Copyright JS Foundation and other contributors
- * Released under the MIT license
- * https://js.foundation/
- *
- * Date: 2021-02-16
- */
-( function( window ) {
+
+
+function nodeName( elem, name ) {
+
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
+
+}
+var pop = arr.pop;
+
+
+var sort = arr.sort;
+
+
+var splice = arr.splice;
+
+
+var whitespace = "[\\x20\\t\\r\\n\\f]";
+
+
+var rtrimCSS = new RegExp(
+ "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
+ "g"
+);
+
+
+
+
+// Note: an element does not contain itself
+jQuery.contains = function( a, b ) {
+ var bup = b && b.parentNode;
+
+ return a === bup || !!( bup && bup.nodeType === 1 && (
+
+ // Support: IE 9 - 11+
+ // IE doesn't have `contains` on SVG.
+ a.contains ?
+ a.contains( bup ) :
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+ ) );
+};
+
+
+
+
+// CSS string/identifier serialization
+// https://drafts.csswg.org/cssom/#common-serializing-idioms
+var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
+
+function fcssescape( 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;
+}
+
+jQuery.escapeSelector = function( sel ) {
+ return ( sel + "" ).replace( rcssescape, fcssescape );
+};
+
+
+
+
+var preferredDoc = document,
+ pushNative = push;
+
+( function() {
+
var i,
- support,
Expr,
- getText,
- isXML,
- tokenize,
- compile,
- select,
outermostContext,
sortInput,
hasDuplicate,
+ push = pushNative,
// Local document vars
- setDocument,
document,
- docElem,
+ documentElement,
documentIsHTML,
rbuggyQSA,
- rbuggyMatches,
matches,
- contains,
// Instance-specific data
- expando = "sizzle" + 1 * new Date(),
- preferredDoc = window.document,
+ expando = jQuery.expando,
dirruns = 0,
done = 0,
classCache = createCache(),
@@ -570,47 +664,22 @@ var i,
return 0;
},
- // Instance methods
- hasOwn = ( {} ).hasOwnProperty,
- arr = [],
- pop = arr.pop,
- pushNative = arr.push,
- 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
- indexOf = function( list, elem ) {
- var i = 0,
- len = list.length;
- for ( ; i < len; i++ ) {
- if ( list[ i ] === elem ) {
- return i;
- }
- }
- return -1;
- },
-
- booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
- "ismap|loop|multiple|open|readonly|required|scoped",
+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" +
+ "loop|multiple|open|readonly|required|scoped",
// Regular expressions
- // http://www.w3.org/TR/css3-selectors/#whitespace
- whitespace = "[\\x20\\t\\r\\n\\f]",
-
// https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
- // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
+ // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
// Operator (capture 2)
"*([*^$|!~]?=)" + whitespace +
- // "Attribute values must be CSS identifiers [capture 5]
- // or strings [capture 3 or capture 4]"
+ // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
whitespace + "*\\]",
@@ -629,101 +698,88 @@ var i,
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rwhitespace = new RegExp( whitespace + "+", "g" ),
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
- whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
- rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
- "*" ),
+ rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" +
+ whitespace + "*" ),
rdescend = new RegExp( whitespace + "|>" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
- "ID": new RegExp( "^#(" + identifier + ")" ),
- "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
- "TAG": new RegExp( "^(" + identifier + "|[*])" ),
- "ATTR": new RegExp( "^" + attributes ),
- "PSEUDO": new RegExp( "^" + pseudos ),
- "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
- whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
- whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
- "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
+ ID: new RegExp( "^#(" + identifier + ")" ),
+ CLASS: new RegExp( "^\\.(" + identifier + ")" ),
+ TAG: new RegExp( "^(" + identifier + "|[*])" ),
+ ATTR: new RegExp( "^" + attributes ),
+ PSEUDO: new RegExp( "^" + pseudos ),
+ CHILD: new RegExp(
+ "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
+ whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
+ whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+ bool: new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
- "needsContext": new RegExp( "^" + whitespace +
+ needsContext: new RegExp( "^" + whitespace +
"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
"*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
- rhtml = /HTML$/i,
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
- rnative = /^[^{]+\{\s*\[native \w/,
-
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rsibling = /[+~]/,
// CSS escapes
- // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
- runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
+ // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
+ runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace +
+ "?|\\\\([^\\r\\n\\f])", "g" ),
funescape = function( escape, nonHex ) {
var high = "0x" + escape.slice( 1 ) - 0x10000;
- return nonHex ?
+ if ( nonHex ) {
// Strip the backslash prefix from a non-hex escape sequence
- nonHex :
-
- // Replace a hexadecimal escape sequence with the encoded Unicode code point
- // Support: IE <=11+
- // For values outside the Basic Multilingual Plane (BMP), manually construct a
- // surrogate pair
- high < 0 ?
- String.fromCharCode( high + 0x10000 ) :
- 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 ) + " ";
+ return nonHex;
}
- // Other potentially-special ASCII characters get backslash-escaped
- return "\\" + ch;
+ // Replace a hexadecimal escape sequence with the encoded Unicode code point
+ // Support: IE <=11+
+ // For values outside the Basic Multilingual Plane (BMP), manually construct a
+ // surrogate pair
+ return high < 0 ?
+ String.fromCharCode( high + 0x10000 ) :
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
},
- // Used for iframes
- // See setDocument()
+ // Used for iframes; see `setDocument`.
+ // Support: IE 9 - 11+, Edge 12 - 18+
// Removing the function wrapper causes a "Permission Denied"
- // error in IE
+ // error in IE/Edge.
unloadHandler = function() {
setDocument();
},
inDisabledFieldset = addCombinator(
function( elem ) {
- return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
+ return elem.disabled === true && nodeName( elem, "fieldset" );
},
{ dir: "parentNode", next: "legend" }
);
+// Support: IE <=9 only
+// Accessing document.activeElement can throw unexpectedly
+// https://bugs.jquery.com/ticket/13393
+function safeActiveElement() {
+ try {
+ return document.activeElement;
+ } catch ( err ) { }
+}
+
// Optimize for push.apply( _, NodeList )
try {
push.apply(
@@ -731,32 +787,22 @@ try {
preferredDoc.childNodes
);
- // Support: Android<4.0
+ // Support: Android <=4.0
// Detect silently failing push.apply
// eslint-disable-next-line no-unused-expressions
arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
- push = { apply: arr.length ?
-
- // Leverage slice if possible
- function( target, els ) {
+ push = {
+ apply: function( target, els ) {
pushNative.apply( target, slice.call( els ) );
- } :
-
- // Support: IE<9
- // Otherwise append directly
- function( target, els ) {
- var j = target.length,
- i = 0;
-
- // Can't trust NodeList.length
- while ( ( target[ j++ ] = els[ i++ ] ) ) {}
- target.length = j - 1;
+ },
+ call: function( target ) {
+ pushNative.apply( target, slice.call( arguments, 1 ) );
}
};
}
-function Sizzle( selector, context, results, seed ) {
+function find( selector, context, results, seed ) {
var m, i, elem, nid, match, groups, newSelector,
newContext = context && context.ownerDocument,
@@ -790,11 +836,10 @@ function Sizzle( selector, context, results, seed ) {
if ( nodeType === 9 ) {
if ( ( elem = context.getElementById( m ) ) ) {
- // Support: IE, Opera, Webkit
- // TODO: identify versions
+ // Support: IE 9 only
// getElementById can match elements by name instead of ID
if ( elem.id === m ) {
- results.push( elem );
+ push.call( results, elem );
return results;
}
} else {
@@ -804,14 +849,13 @@ function Sizzle( selector, context, results, seed ) {
// Element context
} else {
- // Support: IE, Opera, Webkit
- // TODO: identify versions
+ // Support: IE 9 only
// getElementById can match elements by name instead of ID
if ( newContext && ( elem = newContext.getElementById( m ) ) &&
- contains( context, elem ) &&
+ find.contains( context, elem ) &&
elem.id === m ) {
- results.push( elem );
+ push.call( results, elem );
return results;
}
}
@@ -822,22 +866,15 @@ function Sizzle( selector, context, results, seed ) {
return results;
// Class selector
- } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
- context.getElementsByClassName ) {
-
+ } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) {
push.apply( results, context.getElementsByClassName( m ) );
return results;
}
}
// Take advantage of querySelectorAll
- if ( support.qsa &&
- !nonnativeSelectorCache[ selector + " " ] &&
- ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
-
- // Support: IE 8 only
- // Exclude object elements
- ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
+ if ( !nonnativeSelectorCache[ selector + " " ] &&
+ ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) {
newSelector = selector;
newContext = context;
@@ -850,7 +887,7 @@ function Sizzle( selector, context, results, seed ) {
// as such selectors are not recognized by querySelectorAll.
// Thanks to Andrew Dupont for this technique.
if ( nodeType === 1 &&
- ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
+ ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) {
// Expand context for sibling selectors
newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
@@ -858,11 +895,15 @@ function Sizzle( selector, context, results, seed ) {
// We can use :scope instead of the ID hack if the browser
// supports it & if we're not changing the context.
- if ( newContext !== context || !support.scope ) {
+ // Support: IE 11+, Edge 17 - 18+
+ // IE/Edge sometimes throw a "Permission denied" error when
+ // strict-comparing two documents; shallow comparisons work.
+ // eslint-disable-next-line eqeqeq
+ if ( newContext != context || !support.scope ) {
// Capture the context ID, setting it first if necessary
if ( ( nid = context.getAttribute( "id" ) ) ) {
- nid = nid.replace( rcssescape, fcssescape );
+ nid = jQuery.escapeSelector( nid );
} else {
context.setAttribute( "id", ( nid = expando ) );
}
@@ -895,7 +936,7 @@ function Sizzle( selector, context, results, seed ) {
}
// All others
- return select( selector.replace( rtrim, "$1" ), context, results, seed );
+ return select( selector.replace( rtrimCSS, "$1" ), context, results, seed );
}
/**
@@ -909,7 +950,8 @@ function createCache() {
function cache( key, value ) {
- // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
+ // Use (key + " ") to avoid collision with native prototype properties
+ // (see https://github.com/jquery/sizzle/issues/157)
if ( keys.push( key + " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
@@ -921,7 +963,7 @@ function createCache() {
}
/**
- * Mark a function for special use by Sizzle
+ * Mark a function for special use by jQuery selector module
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
@@ -952,56 +994,13 @@ function assert( fn ) {
}
}
-/**
- * Adds the same handler for all of the specified attrs
- * @param {String} attrs Pipe-separated list of attributes
- * @param {Function} handler The method that will be applied
- */
-function addHandle( attrs, handler ) {
- var arr = attrs.split( "|" ),
- i = arr.length;
-
- while ( i-- ) {
- Expr.attrHandle[ arr[ i ] ] = handler;
- }
-}
-
-/**
- * Checks document order of two siblings
- * @param {Element} a
- * @param {Element} b
- * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
- */
-function siblingCheck( a, b ) {
- var cur = b && a,
- diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
- a.sourceIndex - b.sourceIndex;
-
- // Use IE sourceIndex if available on both nodes
- if ( diff ) {
- return diff;
- }
-
- // Check if b follows a
- if ( cur ) {
- while ( ( cur = cur.nextSibling ) ) {
- if ( cur === b ) {
- return -1;
- }
- }
- }
-
- return a ? 1 : -1;
-}
-
/**
* Returns a function to use in pseudos for input types
* @param {String} type
*/
function createInputPseudo( type ) {
return function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && elem.type === type;
+ return nodeName( elem, "input" ) && elem.type === type;
};
}
@@ -1011,8 +1010,8 @@ function createInputPseudo( type ) {
*/
function createButtonPseudo( type ) {
return function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return ( name === "input" || name === "button" ) && elem.type === type;
+ return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&
+ elem.type === type;
};
}
@@ -1048,14 +1047,13 @@ function createDisabledPseudo( disabled ) {
}
}
- // Support: IE 6 - 11
+ // 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 &&
- inDisabledFieldset( elem ) === disabled;
+ inDisabledFieldset( elem ) === disabled;
}
return elem.disabled === disabled;
@@ -1095,7 +1093,7 @@ function createPositionalPseudo( fn ) {
}
/**
- * Checks a node for validity as a Sizzle context
+ * Checks a node for validity as a jQuery selector context
* @param {Element|Object=} context
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
*/
@@ -1103,31 +1101,13 @@ function testContext( context ) {
return context && typeof context.getElementsByTagName !== "undefined" && context;
}
-// Expose support vars for convenience
-support = Sizzle.support = {};
-
-/**
- * Detects XML nodes
- * @param {Element|Object} elem An element or a document
- * @returns {Boolean} True iff elem is a non-HTML XML node
- */
-isXML = Sizzle.isXML = function( elem ) {
- var namespace = elem && elem.namespaceURI,
- docElem = elem && ( elem.ownerDocument || elem ).documentElement;
-
- // Support: IE <=8
- // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
- // https://bugs.jquery.com/ticket/4833
- return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
-};
-
/**
* Sets document-related variables once based on the current document
- * @param {Element|Object} [doc] An element or document object to use to set the document
+ * @param {Element|Object} [node] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
-setDocument = Sizzle.setDocument = function( node ) {
- var hasCompare, subWindow,
+function setDocument( node ) {
+ var subWindow,
doc = node ? node.ownerDocument || node : preferredDoc;
// Return early if doc is invalid or already selected
@@ -1141,87 +1121,90 @@ setDocument = Sizzle.setDocument = function( node ) {
// Update global variables
document = doc;
- docElem = document.documentElement;
- documentIsHTML = !isXML( document );
+ documentElement = document.documentElement;
+ documentIsHTML = !jQuery.isXMLDoc( document );
+
+ // Support: iOS 7 only, IE 9 - 11+
+ // Older browsers didn't support unprefixed `matches`.
+ matches = documentElement.matches ||
+ documentElement.webkitMatchesSelector ||
+ documentElement.msMatchesSelector;
// Support: IE 9 - 11+, Edge 12 - 18+
- // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- // eslint-disable-next-line eqeqeq
- if ( preferredDoc != document &&
- ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
+ // Accessing iframe documents after unload throws "permission denied" errors
+ // (see trac-13936).
+ // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`,
+ // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well.
+ if ( documentElement.msMatchesSelector &&
- // Support: IE 11, Edge
- if ( subWindow.addEventListener ) {
- subWindow.addEventListener( "unload", unloadHandler, false );
+ // Support: IE 11+, Edge 17 - 18+
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
+ // two documents; shallow comparisons work.
+ // eslint-disable-next-line eqeqeq
+ preferredDoc != document &&
+ ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
- // Support: IE 9 - 10 only
- } else if ( subWindow.attachEvent ) {
- subWindow.attachEvent( "onunload", unloadHandler );
- }
+ // Support: IE 9 - 11+, Edge 12 - 18+
+ subWindow.addEventListener( "unload", unloadHandler );
}
- // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
- // Safari 4 - 5 only, Opera <=11.6 - 12.x only
- // IE/Edge & older browsers don't support the :scope pseudo-class.
- // Support: Safari 6.0 only
- // Safari 6.0 supports :scope but it's an alias of :root there.
- support.scope = assert( function( el ) {
- docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
- return typeof el.querySelectorAll !== "undefined" &&
- !el.querySelectorAll( ":scope fieldset div" ).length;
+ // Support: IE <10
+ // Check if getElementById returns elements by name
+ // The broken getElementById methods don't pick up programmatically-set names,
+ // so use a roundabout getElementsByName test
+ support.getById = assert( function( el ) {
+ documentElement.appendChild( el ).id = jQuery.expando;
+ return !document.getElementsByName ||
+ !document.getElementsByName( jQuery.expando ).length;
} );
- /* Attributes
- ---------------------------------------------------------------------- */
-
- // 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: IE 9 only
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node.
+ support.disconnectedMatch = assert( function( el ) {
+ return matches.call( el, "*" );
} );
- /* getElement(s)By*
- ---------------------------------------------------------------------- */
-
- // Check if getElementsByTagName("*") returns only elements
- support.getElementsByTagName = assert( function( el ) {
- el.appendChild( document.createComment( "" ) );
- return !el.getElementsByTagName( "*" ).length;
+ // Support: IE 9 - 11+, Edge 12 - 18+
+ // IE/Edge don't support the :scope pseudo-class.
+ support.scope = assert( function() {
+ return document.querySelectorAll( ":scope" );
} );
- // Support: IE<9
- support.getElementsByClassName = rnative.test( document.getElementsByClassName );
-
- // Support: IE<10
- // Check if getElementById returns elements by name
- // The broken getElementById methods don't pick up programmatically-set names,
- // so use a roundabout getElementsByName test
- support.getById = assert( function( el ) {
- docElem.appendChild( el ).id = expando;
- return !document.getElementsByName || !document.getElementsByName( expando ).length;
+ // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only
+ // Make sure the `:has()` argument is parsed unforgivingly.
+ // We include `*` in the test to detect buggy implementations that are
+ // _selectively_ forgiving (specifically when the list includes at least
+ // one valid selector).
+ // Note that we treat complete lack of support for `:has()` as if it were
+ // spec-compliant support, which is fine because use of `:has()` in such
+ // environments will fail in the qSA path and fall back to jQuery traversal
+ // anyway.
+ support.cssHas = assert( function() {
+ try {
+ document.querySelector( ":has(*,:jqfake)" );
+ return false;
+ } catch ( e ) {
+ return true;
+ }
} );
// ID filter and find
if ( support.getById ) {
- Expr.filter[ "ID" ] = function( id ) {
+ 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 ) {
+ Expr.find.ID = function( id, context ) {
if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
var elem = context.getElementById( id );
return elem ? [ elem ] : [];
}
};
} else {
- Expr.filter[ "ID" ] = function( id ) {
+ Expr.filter.ID = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== "undefined" &&
@@ -1232,7 +1215,7 @@ setDocument = Sizzle.setDocument = function( node ) {
// Support: IE 6 - 7 only
// getElementById is not reliable as a find shortcut
- Expr.find[ "ID" ] = function( id, context ) {
+ Expr.find.ID = function( id, context ) {
if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
var node, i, elems,
elem = context.getElementById( id );
@@ -1262,40 +1245,18 @@ setDocument = Sizzle.setDocument = function( node ) {
}
// Tag
- Expr.find[ "TAG" ] = support.getElementsByTagName ?
- function( tag, context ) {
- if ( typeof context.getElementsByTagName !== "undefined" ) {
- return context.getElementsByTagName( tag );
-
- // DocumentFragment nodes don't have gEBTN
- } else if ( support.qsa ) {
- return context.querySelectorAll( tag );
- }
- } :
-
- function( tag, context ) {
- var elem,
- tmp = [],
- i = 0,
-
- // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
- results = context.getElementsByTagName( tag );
-
- // Filter out possible comments
- if ( tag === "*" ) {
- while ( ( elem = results[ i++ ] ) ) {
- if ( elem.nodeType === 1 ) {
- tmp.push( elem );
- }
- }
+ Expr.find.TAG = function( tag, context ) {
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
+ return context.getElementsByTagName( tag );
- return tmp;
- }
- return results;
- };
+ // DocumentFragment nodes don't have gEBTN
+ } else {
+ return context.querySelectorAll( tag );
+ }
+ };
// Class
- Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
+ Expr.find.CLASS = function( className, context ) {
if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
return context.getElementsByClassName( className );
}
@@ -1306,177 +1267,94 @@ setDocument = Sizzle.setDocument = function( node ) {
// QSA and matchesSelector support
- // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
- rbuggyMatches = [];
-
- // qSa(:focus) reports false when true (Chrome 21)
- // 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
rbuggyQSA = [];
- if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
+ // Build QSA regex
+ // Regex strategy adopted from Diego Perini
+ assert( function( el ) {
- // Build QSA regex
- // Regex strategy adopted from Diego Perini
- assert( function( el ) {
+ var input;
- var input;
+ documentElement.appendChild( el ).innerHTML =
+ "" +
+ "";
- // 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 = "" +
- "";
-
- // 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 ) {
- rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
- }
-
- // Support: IE8
- // Boolean attributes and "value" are not treated correctly
- if ( !el.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 ) {
- rbuggyQSA.push( "~=" );
- }
-
- // Support: IE 11+, Edge 15 - 18+
- // IE 11/Edge don't find elements on a `[name='']` query in some cases.
- // Adding a temporary attribute to the document before the selection works
- // around the issue.
- // Interestingly, IE 10 & older don't seem to have the issue.
- input = document.createElement( "input" );
- input.setAttribute( "name", "" );
- el.appendChild( input );
- if ( !el.querySelectorAll( "[name='']" ).length ) {
- rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
- whitespace + "*(?:''|\"\")" );
- }
-
- // 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 ) {
- 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 ) {
- rbuggyQSA.push( ".#.+[+~]" );
- }
-
- // Support: Firefox <=3.6 - 5 only
- // Old Firefox doesn't throw on a badly-escaped identifier.
- el.querySelectorAll( "\\\f" );
- rbuggyQSA.push( "[\\r\\n\\f]" );
- } );
-
- assert( function( el ) {
- el.innerHTML = "" +
- "";
-
- // 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" );
-
- // Support: IE8
- // Enforce case-sensitivity of name attribute
- if ( el.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: iOS <=7 - 8 only
+ // Boolean attributes and "value" are not treated correctly in some XML documents
+ if ( !el.querySelectorAll( "[selected]" ).length ) {
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
+ }
- // 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 ) {
- rbuggyQSA.push( ":enabled", ":disabled" );
- }
+ // Support: iOS <=7 - 8 only
+ if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
+ rbuggyQSA.push( "~=" );
+ }
- // Support: Opera 10 - 11 only
- // Opera 10-11 does not throw on post-comma invalid pseudos
- el.querySelectorAll( "*,:x" );
- rbuggyQSA.push( ",.*:" );
- } );
- }
+ // Support: iOS 8 only
+ // https://bugs.webkit.org/show_bug.cgi?id=136851
+ // In-page `selector#id sibling-combinator selector` fails
+ if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
+ rbuggyQSA.push( ".#.+[+~]" );
+ }
- if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
- docElem.webkitMatchesSelector ||
- docElem.mozMatchesSelector ||
- docElem.oMatchesSelector ||
- docElem.msMatchesSelector ) ) ) ) {
+ // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
+ // In some of the document kinds, these selectors wouldn't work natively.
+ // This is probably OK but for backwards compatibility we want to maintain
+ // handling them through jQuery traversal in jQuery 3.x.
+ if ( !el.querySelectorAll( ":checked" ).length ) {
+ rbuggyQSA.push( ":checked" );
+ }
- assert( function( el ) {
+ // Support: Windows 8 Native Apps
+ // The type and name attributes are restricted during .innerHTML assignment
+ input = document.createElement( "input" );
+ input.setAttribute( "type", "hidden" );
+ el.appendChild( input ).setAttribute( "name", "D" );
+
+ // Support: IE 9 - 11+
+ // IE's :disabled selector does not pick up the children of disabled fieldsets
+ // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
+ // In some of the document kinds, these selectors wouldn't work natively.
+ // This is probably OK but for backwards compatibility we want to maintain
+ // handling them through jQuery traversal in jQuery 3.x.
+ documentElement.appendChild( el ).disabled = true;
+ if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
+ rbuggyQSA.push( ":enabled", ":disabled" );
+ }
+
+ // Support: IE 11+, Edge 15 - 18+
+ // IE 11/Edge don't find elements on a `[name='']` query in some cases.
+ // Adding a temporary attribute to the document before the selection works
+ // around the issue.
+ // Interestingly, IE 10 & older don't seem to have the issue.
+ input = document.createElement( "input" );
+ input.setAttribute( "name", "" );
+ el.appendChild( input );
+ if ( !el.querySelectorAll( "[name='']" ).length ) {
+ rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
+ whitespace + "*(?:''|\"\")" );
+ }
+ } );
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9)
- support.disconnectedMatch = matches.call( el, "*" );
+ if ( !support.cssHas ) {
- // This should fail with an exception
- // Gecko does not error, returns false instead
- matches.call( el, "[s!='']:x" );
- rbuggyMatches.push( "!=", pseudos );
- } );
+ // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
+ // Our regular `try-catch` mechanism fails to detect natively-unsupported
+ // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
+ // in browsers that parse the `:has()` argument as a forgiving selector list.
+ // https://drafts.csswg.org/selectors/#relational now requires the argument
+ // to be parsed unforgivingly, but browsers have not yet fully adjusted.
+ rbuggyQSA.push( ":has" );
}
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
- rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
-
- /* Contains
- ---------------------------------------------------------------------- */
- hasCompare = rnative.test( docElem.compareDocumentPosition );
-
- // Element contains another
- // Purposefully self-exclusive
- // As in, an element does not contain itself
- contains = hasCompare || rnative.test( docElem.contains ) ?
- function( a, b ) {
- var adown = a.nodeType === 9 ? a.documentElement : a,
- bup = b && b.parentNode;
- return a === bup || !!( bup && bup.nodeType === 1 && (
- adown.contains ?
- adown.contains( bup ) :
- a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
- ) );
- } :
- function( a, b ) {
- if ( b ) {
- while ( ( b = b.parentNode ) ) {
- if ( b === a ) {
- return true;
- }
- }
- }
- return false;
- };
/* Sorting
---------------------------------------------------------------------- */
// Document order sorting
- sortOrder = hasCompare ?
- function( a, b ) {
+ sortOrder = function( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
@@ -1510,8 +1388,8 @@ setDocument = Sizzle.setDocument = function( node ) {
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
- if ( a == document || a.ownerDocument == preferredDoc &&
- contains( preferredDoc, a ) ) {
+ if ( a === document || a.ownerDocument == preferredDoc &&
+ find.contains( preferredDoc, a ) ) {
return -1;
}
@@ -1519,100 +1397,33 @@ setDocument = Sizzle.setDocument = function( node ) {
// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
// two documents; shallow comparisons work.
// eslint-disable-next-line eqeqeq
- if ( b == document || b.ownerDocument == preferredDoc &&
- contains( preferredDoc, b ) ) {
+ if ( b === document || b.ownerDocument == preferredDoc &&
+ find.contains( preferredDoc, b ) ) {
return 1;
}
// Maintain original order
return sortInput ?
- ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
}
return compare & 4 ? -1 : 1;
- } :
- function( a, b ) {
-
- // Exit early if the nodes are identical
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
- }
-
- var cur,
- i = 0,
- aup = a.parentNode,
- bup = b.parentNode,
- ap = [ a ],
- bp = [ b ];
-
- // Parentless nodes are either documents or disconnected
- if ( !aup || !bup ) {
-
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- /* eslint-disable eqeqeq */
- return a == document ? -1 :
- b == document ? 1 :
- /* eslint-enable eqeqeq */
- aup ? -1 :
- bup ? 1 :
- sortInput ?
- ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
- 0;
-
- // If the nodes are siblings, we can do a quick check
- } else if ( aup === bup ) {
- return siblingCheck( a, b );
- }
-
- // Otherwise we need full lists of their ancestors for comparison
- cur = a;
- while ( ( cur = cur.parentNode ) ) {
- ap.unshift( cur );
- }
- cur = b;
- while ( ( cur = cur.parentNode ) ) {
- bp.unshift( cur );
- }
-
- // Walk down the tree looking for a discrepancy
- while ( ap[ i ] === bp[ i ] ) {
- i++;
- }
-
- return i ?
-
- // Do a sibling check if the nodes have a common ancestor
- siblingCheck( ap[ i ], bp[ i ] ) :
-
- // Otherwise nodes in our document sort first
- // Support: IE 11+, Edge 17 - 18+
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
- // two documents; shallow comparisons work.
- /* eslint-disable eqeqeq */
- ap[ i ] == preferredDoc ? -1 :
- bp[ i ] == preferredDoc ? 1 :
- /* eslint-enable eqeqeq */
- 0;
};
return document;
-};
+}
-Sizzle.matches = function( expr, elements ) {
- return Sizzle( expr, null, null, elements );
+find.matches = function( expr, elements ) {
+ return find( expr, null, null, elements );
};
-Sizzle.matchesSelector = function( elem, expr ) {
+find.matchesSelector = function( elem, expr ) {
setDocument( elem );
- if ( support.matchesSelector && documentIsHTML &&
+ if ( documentIsHTML &&
!nonnativeSelectorCache[ expr + " " ] &&
- ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
- ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
+ ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
try {
var ret = matches.call( elem, expr );
@@ -1620,9 +1431,9 @@ Sizzle.matchesSelector = function( elem, expr ) {
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
- // As well, disconnected nodes are said to be in a document
- // fragment in IE 9
- elem.document && elem.document.nodeType !== 11 ) {
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9
+ elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch ( e ) {
@@ -1630,10 +1441,10 @@ Sizzle.matchesSelector = function( elem, expr ) {
}
}
- return Sizzle( expr, document, null, [ elem ] ).length > 0;
+ return find( expr, document, null, [ elem ] ).length > 0;
};
-Sizzle.contains = function( context, elem ) {
+find.contains = function( context, elem ) {
// Set document vars if needed
// Support: IE 11+, Edge 17 - 18+
@@ -1643,10 +1454,11 @@ Sizzle.contains = function( context, elem ) {
if ( ( context.ownerDocument || context ) != document ) {
setDocument( context );
}
- return contains( context, elem );
+ return jQuery.contains( context, elem );
};
-Sizzle.attr = function( elem, name ) {
+
+find.attr = function( elem, name ) {
// Set document vars if needed
// Support: IE 11+, Edge 17 - 18+
@@ -1659,25 +1471,19 @@ Sizzle.attr = function( elem, name ) {
var fn = Expr.attrHandle[ name.toLowerCase() ],
- // Don't get fooled by Object.prototype properties (jQuery #13807)
+ // Don't get fooled by Object.prototype properties (see trac-13807)
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
fn( elem, name, !documentIsHTML ) :
undefined;
- return val !== undefined ?
- val :
- support.attributes || !documentIsHTML ?
- elem.getAttribute( name ) :
- ( val = elem.getAttributeNode( name ) ) && val.specified ?
- val.value :
- null;
-};
+ if ( val !== undefined ) {
+ return val;
+ }
-Sizzle.escape = function( sel ) {
- return ( sel + "" ).replace( rcssescape, fcssescape );
+ return elem.getAttribute( name );
};
-Sizzle.error = function( msg ) {
+find.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
@@ -1685,76 +1491,44 @@ Sizzle.error = function( msg ) {
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
-Sizzle.uniqueSort = function( results ) {
+jQuery.uniqueSort = function( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
// Unless we *know* we can detect duplicates, assume their presence
- hasDuplicate = !support.detectDuplicates;
- sortInput = !support.sortStable && results.slice( 0 );
- results.sort( sortOrder );
+ //
+ // Support: Android <=4.0+
+ // Testing for detecting duplicates is unpredictable so instead assume we can't
+ // depend on duplicate detection in all browsers without a stable sort.
+ hasDuplicate = !support.sortStable;
+ sortInput = !support.sortStable && slice.call( results, 0 );
+ sort.call( results, sortOrder );
if ( hasDuplicate ) {
- while ( ( elem = results[ i++ ] ) ) {
- if ( elem === results[ i ] ) {
- j = duplicates.push( i );
- }
- }
- while ( j-- ) {
- results.splice( duplicates[ j ], 1 );
- }
- }
-
- // Clear input after sorting to release objects
- // See https://github.com/jquery/sizzle/pull/225
- sortInput = null;
-
- return results;
-};
-
-/**
- * Utility function for retrieving the text value of an array of DOM nodes
- * @param {Array|Element} elem
- */
-getText = Sizzle.getText = function( elem ) {
- var node,
- ret = "",
- i = 0,
- nodeType = elem.nodeType;
-
- if ( !nodeType ) {
-
- // If no nodeType, this is expected to be an array
- while ( ( node = elem[ i++ ] ) ) {
-
- // Do not traverse comment nodes
- ret += getText( node );
- }
- } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
-
- // Use textContent for elements
- // innerText usage removed for consistency of new lines (jQuery #11153)
- if ( typeof elem.textContent === "string" ) {
- return elem.textContent;
- } else {
-
- // Traverse its children
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
- ret += getText( elem );
+ while ( ( elem = results[ i++ ] ) ) {
+ if ( elem === results[ i ] ) {
+ j = duplicates.push( i );
}
}
- } else if ( nodeType === 3 || nodeType === 4 ) {
- return elem.nodeValue;
+ while ( j-- ) {
+ splice.call( results, duplicates[ j ], 1 );
+ }
}
- // Do not include comment or processing instruction nodes
+ // Clear input after sorting to release objects
+ // See https://github.com/jquery/sizzle/pull/225
+ sortInput = null;
+
+ return results;
+};
- return ret;
+jQuery.fn.uniqueSort = function() {
+ return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
};
-Expr = Sizzle.selectors = {
+Expr = jQuery.expr = {
// Can be adjusted by the user
cacheLength: 50,
@@ -1775,12 +1549,12 @@ Expr = Sizzle.selectors = {
},
preFilter: {
- "ATTR": function( match ) {
+ ATTR: function( match ) {
match[ 1 ] = match[ 1 ].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
- match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
- match[ 5 ] || "" ).replace( runescape, funescape );
+ match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )
+ .replace( runescape, funescape );
if ( match[ 2 ] === "~=" ) {
match[ 3 ] = " " + match[ 3 ] + " ";
@@ -1789,7 +1563,7 @@ Expr = Sizzle.selectors = {
return match.slice( 0, 4 );
},
- "CHILD": function( match ) {
+ CHILD: function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
@@ -1807,29 +1581,30 @@ Expr = Sizzle.selectors = {
// nth-* requires argument
if ( !match[ 3 ] ) {
- Sizzle.error( match[ 0 ] );
+ find.error( match[ 0 ] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[ 4 ] = +( match[ 4 ] ?
match[ 5 ] + ( match[ 6 ] || 1 ) :
- 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
+ 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )
+ );
match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
- // other types prohibit arguments
+ // other types prohibit arguments
} else if ( match[ 3 ] ) {
- Sizzle.error( match[ 0 ] );
+ find.error( match[ 0 ] );
}
return match;
},
- "PSEUDO": function( match ) {
+ PSEUDO: function( match ) {
var excess,
unquoted = !match[ 6 ] && match[ 2 ];
- if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
+ if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
return null;
}
@@ -1858,36 +1633,36 @@ Expr = Sizzle.selectors = {
filter: {
- "TAG": function( nodeNameSelector ) {
- var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
+ TAG: function( nodeNameSelector ) {
+ var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
return nodeNameSelector === "*" ?
function() {
return true;
} :
function( elem ) {
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+ return nodeName( elem, expectedNodeName );
};
},
- "CLASS": function( className ) {
+ CLASS: function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
- ( pattern = new RegExp( "(^|" + whitespace +
- ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
- className, function( elem ) {
- return pattern.test(
- typeof elem.className === "string" && elem.className ||
- typeof elem.getAttribute !== "undefined" &&
- elem.getAttribute( "class" ) ||
- ""
- );
+ ( pattern = new RegExp( "(^|" + whitespace + ")" + className +
+ "(" + whitespace + "|$)" ) ) &&
+ classCache( className, function( elem ) {
+ return pattern.test(
+ typeof elem.className === "string" && elem.className ||
+ typeof elem.getAttribute !== "undefined" &&
+ elem.getAttribute( "class" ) ||
+ ""
+ );
} );
},
- "ATTR": function( name, operator, check ) {
+ ATTR: function( name, operator, check ) {
return function( elem ) {
- var result = Sizzle.attr( elem, name );
+ var result = find.attr( elem, name );
if ( result == null ) {
return operator === "!=";
@@ -1898,22 +1673,34 @@ Expr = Sizzle.selectors = {
result += "";
- /* eslint-disable max-len */
-
- return operator === "=" ? result === check :
- operator === "!=" ? result !== check :
- operator === "^=" ? check && result.indexOf( check ) === 0 :
- operator === "*=" ? check && result.indexOf( check ) > -1 :
- operator === "$=" ? check && result.slice( -check.length ) === check :
- operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
- operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
- false;
- /* eslint-enable max-len */
+ if ( operator === "=" ) {
+ return result === check;
+ }
+ if ( operator === "!=" ) {
+ return result !== check;
+ }
+ if ( operator === "^=" ) {
+ return check && result.indexOf( check ) === 0;
+ }
+ if ( operator === "*=" ) {
+ return check && result.indexOf( check ) > -1;
+ }
+ if ( operator === "$=" ) {
+ return check && result.slice( -check.length ) === check;
+ }
+ if ( operator === "~=" ) {
+ return ( " " + result.replace( rwhitespace, " " ) + " " )
+ .indexOf( check ) > -1;
+ }
+ if ( operator === "|=" ) {
+ return result === check || result.slice( 0, check.length + 1 ) === check + "-";
+ }
+ return false;
};
},
- "CHILD": function( type, what, _argument, first, last ) {
+ CHILD: function( type, what, _argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
@@ -1926,7 +1713,7 @@ Expr = Sizzle.selectors = {
} :
function( elem, _context, xml ) {
- var cache, uniqueCache, outerCache, node, nodeIndex, start,
+ var cache, outerCache, node, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
@@ -1941,7 +1728,7 @@ Expr = Sizzle.selectors = {
node = elem;
while ( ( node = node[ dir ] ) ) {
if ( ofType ?
- node.nodeName.toLowerCase() === name :
+ nodeName( node, name ) :
node.nodeType === 1 ) {
return false;
@@ -1960,17 +1747,8 @@ Expr = Sizzle.selectors = {
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
-
- // ...in a gzip-friendly way
- node = parent;
- outerCache = node[ expando ] || ( node[ expando ] = {} );
-
- // Support: IE <9 only
- // Defend against cloned attroperties (jQuery gh-1709)
- uniqueCache = outerCache[ node.uniqueID ] ||
- ( outerCache[ node.uniqueID ] = {} );
-
- cache = uniqueCache[ type ] || [];
+ outerCache = parent[ expando ] || ( parent[ expando ] = {} );
+ cache = outerCache[ type ] || [];
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
diff = nodeIndex && cache[ 2 ];
node = nodeIndex && parent.childNodes[ nodeIndex ];
@@ -1982,7 +1760,7 @@ Expr = Sizzle.selectors = {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
- uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
@@ -1991,17 +1769,8 @@ Expr = Sizzle.selectors = {
// Use previously-cached element index if available
if ( useCache ) {
-
- // ...in a gzip-friendly way
- node = elem;
- outerCache = node[ expando ] || ( node[ expando ] = {} );
-
- // Support: IE <9 only
- // Defend against cloned attroperties (jQuery gh-1709)
- uniqueCache = outerCache[ node.uniqueID ] ||
- ( outerCache[ node.uniqueID ] = {} );
-
- cache = uniqueCache[ type ] || [];
+ outerCache = elem[ expando ] || ( elem[ expando ] = {} );
+ cache = outerCache[ type ] || [];
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
diff = nodeIndex;
}
@@ -2015,7 +1784,7 @@ Expr = Sizzle.selectors = {
( diff = nodeIndex = 0 ) || start.pop() ) ) {
if ( ( ofType ?
- node.nodeName.toLowerCase() === name :
+ nodeName( node, name ) :
node.nodeType === 1 ) &&
++diff ) {
@@ -2023,13 +1792,7 @@ Expr = Sizzle.selectors = {
if ( useCache ) {
outerCache = node[ expando ] ||
( node[ expando ] = {} );
-
- // Support: IE <9 only
- // Defend against cloned attroperties (jQuery gh-1709)
- uniqueCache = outerCache[ node.uniqueID ] ||
- ( outerCache[ node.uniqueID ] = {} );
-
- uniqueCache[ type ] = [ dirruns, diff ];
+ outerCache[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
@@ -2047,19 +1810,19 @@ Expr = Sizzle.selectors = {
};
},
- "PSEUDO": function( pseudo, argument ) {
+ PSEUDO: function( pseudo, argument ) {
// pseudo-class names are case-insensitive
- // http://www.w3.org/TR/selectors/#pseudo-classes
+ // https://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
- Sizzle.error( "unsupported pseudo: " + pseudo );
+ find.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
- // just as Sizzle does
+ // just as jQuery does
if ( fn[ expando ] ) {
return fn( argument );
}
@@ -2073,7 +1836,7 @@ Expr = Sizzle.selectors = {
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
- idx = indexOf( seed, matched[ i ] );
+ idx = indexOf.call( seed, matched[ i ] );
seed[ idx ] = !( matches[ idx ] = matched[ i ] );
}
} ) :
@@ -2089,14 +1852,14 @@ Expr = Sizzle.selectors = {
pseudos: {
// Potentially complex pseudos
- "not": markFunction( function( selector ) {
+ not: markFunction( function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
- matcher = compile( selector.replace( rtrim, "$1" ) );
+ matcher = compile( selector.replace( rtrimCSS, "$1" ) );
return matcher[ expando ] ?
markFunction( function( seed, matches, _context, xml ) {
@@ -2115,22 +1878,23 @@ Expr = Sizzle.selectors = {
input[ 0 ] = elem;
matcher( input, null, xml, results );
- // Don't keep the element (issue #299)
+ // Don't keep the element
+ // (see https://github.com/jquery/sizzle/issues/299)
input[ 0 ] = null;
return !results.pop();
};
} ),
- "has": markFunction( function( selector ) {
+ has: markFunction( function( selector ) {
return function( elem ) {
- return Sizzle( selector, elem ).length > 0;
+ return find( selector, elem ).length > 0;
};
} ),
- "contains": markFunction( function( text ) {
+ contains: markFunction( function( text ) {
text = text.replace( runescape, funescape );
return function( elem ) {
- return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
+ return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
};
} ),
@@ -2140,12 +1904,12 @@ Expr = Sizzle.selectors = {
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
- // http://www.w3.org/TR/selectors/#lang-pseudo
- "lang": markFunction( function( lang ) {
+ // https://www.w3.org/TR/selectors/#lang-pseudo
+ lang: markFunction( function( lang ) {
// lang value must be a valid identifier
if ( !ridentifier.test( lang || "" ) ) {
- Sizzle.error( "unsupported lang: " + lang );
+ find.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
@@ -2164,38 +1928,39 @@ Expr = Sizzle.selectors = {
} ),
// Miscellaneous
- "target": function( elem ) {
+ target: function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
- "root": function( elem ) {
- return elem === docElem;
+ root: function( elem ) {
+ return elem === documentElement;
},
- "focus": function( elem ) {
- return elem === document.activeElement &&
- ( !document.hasFocus || document.hasFocus() ) &&
+ focus: function( elem ) {
+ return elem === safeActiveElement() &&
+ document.hasFocus() &&
!!( elem.type || elem.href || ~elem.tabIndex );
},
// Boolean properties
- "enabled": createDisabledPseudo( false ),
- "disabled": createDisabledPseudo( true ),
+ enabled: createDisabledPseudo( false ),
+ disabled: createDisabledPseudo( true ),
- "checked": function( elem ) {
+ checked: function( elem ) {
// In CSS3, :checked should return both checked and selected elements
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
- var nodeName = elem.nodeName.toLowerCase();
- return ( nodeName === "input" && !!elem.checked ) ||
- ( nodeName === "option" && !!elem.selected );
+ // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ return ( nodeName( elem, "input" ) && !!elem.checked ) ||
+ ( nodeName( elem, "option" ) && !!elem.selected );
},
- "selected": function( elem ) {
+ selected: function( elem ) {
- // Accessing this property makes selected-by-default
- // options in Safari work properly
+ // Support: IE <=11+
+ // Accessing the selectedIndex property
+ // forces the browser to treat the default option as
+ // selected when in an optgroup.
if ( elem.parentNode ) {
// eslint-disable-next-line no-unused-expressions
elem.parentNode.selectedIndex;
@@ -2205,9 +1970,9 @@ Expr = Sizzle.selectors = {
},
// Contents
- "empty": function( elem ) {
+ empty: function( elem ) {
- // http://www.w3.org/TR/selectors/#empty-pseudo
+ // https://www.w3.org/TR/selectors/#empty-pseudo
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
// but not by others (comment: 8; processing instruction: 7; etc.)
// nodeType < 6 works because attributes (2) do not appear as children
@@ -2219,49 +1984,49 @@ Expr = Sizzle.selectors = {
return true;
},
- "parent": function( elem ) {
- return !Expr.pseudos[ "empty" ]( elem );
+ parent: function( elem ) {
+ return !Expr.pseudos.empty( elem );
},
// Element/input types
- "header": function( elem ) {
+ header: function( elem ) {
return rheader.test( elem.nodeName );
},
- "input": function( elem ) {
+ input: function( elem ) {
return rinputs.test( elem.nodeName );
},
- "button": function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && elem.type === "button" || name === "button";
+ button: function( elem ) {
+ return nodeName( elem, "input" ) && elem.type === "button" ||
+ nodeName( elem, "button" );
},
- "text": function( elem ) {
+ text: function( elem ) {
var attr;
- return elem.nodeName.toLowerCase() === "input" &&
- elem.type === "text" &&
+ return nodeName( elem, "input" ) && elem.type === "text" &&
- // Support: IE<8
- // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
+ // Support: IE <10 only
+ // New HTML5 attribute values (e.g., "search") appear
+ // with elem.type === "text"
( ( attr = elem.getAttribute( "type" ) ) == null ||
attr.toLowerCase() === "text" );
},
// Position-in-collection
- "first": createPositionalPseudo( function() {
+ first: createPositionalPseudo( function() {
return [ 0 ];
} ),
- "last": createPositionalPseudo( function( _matchIndexes, length ) {
+ last: createPositionalPseudo( function( _matchIndexes, length ) {
return [ length - 1 ];
} ),
- "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
+ eq: createPositionalPseudo( function( _matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
} ),
- "even": createPositionalPseudo( function( matchIndexes, length ) {
+ even: createPositionalPseudo( function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
@@ -2269,7 +2034,7 @@ Expr = Sizzle.selectors = {
return matchIndexes;
} ),
- "odd": createPositionalPseudo( function( matchIndexes, length ) {
+ odd: createPositionalPseudo( function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
@@ -2277,19 +2042,24 @@ Expr = Sizzle.selectors = {
return matchIndexes;
} ),
- "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
- var i = argument < 0 ?
- argument + length :
- argument > length ?
- length :
- argument;
+ lt: createPositionalPseudo( function( matchIndexes, length, argument ) {
+ var i;
+
+ if ( argument < 0 ) {
+ i = argument + length;
+ } else if ( argument > length ) {
+ i = length;
+ } else {
+ i = argument;
+ }
+
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
} ),
- "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
+ gt: createPositionalPseudo( function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
@@ -2299,7 +2069,7 @@ Expr = Sizzle.selectors = {
}
};
-Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
+Expr.pseudos.nth = Expr.pseudos.eq;
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
@@ -2314,7 +2084,7 @@ function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
-tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
+function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
@@ -2342,13 +2112,13 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
matched = false;
// Combinators
- if ( ( match = rcombinators.exec( soFar ) ) ) {
+ if ( ( match = rleadingCombinator.exec( soFar ) ) ) {
matched = match.shift();
tokens.push( {
value: matched,
// Cast descendant combinators to space
- type: match[ 0 ].replace( rtrim, " " )
+ type: match[ 0 ].replace( rtrimCSS, " " )
} );
soFar = soFar.slice( matched.length );
}
@@ -2375,14 +2145,16 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
- return parseOnly ?
- soFar.length :
- soFar ?
- Sizzle.error( selector ) :
+ if ( parseOnly ) {
+ return soFar.length;
+ }
- // Cache the tokens
- tokenCache( selector, groups ).slice( 0 );
-};
+ return soFar ?
+ find.error( selector ) :
+
+ // Cache the tokens
+ tokenCache( selector, groups ).slice( 0 );
+}
function toSelector( tokens ) {
var i = 0,
@@ -2415,7 +2187,7 @@ function addCombinator( matcher, combinator, base ) {
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
- var oldCache, uniqueCache, outerCache,
+ var oldCache, outerCache,
newCache = [ dirruns, doneName ];
// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
@@ -2432,14 +2204,9 @@ function addCombinator( matcher, combinator, base ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || ( elem[ expando ] = {} );
- // Support: IE <9 only
- // Defend against cloned attroperties (jQuery gh-1709)
- uniqueCache = outerCache[ elem.uniqueID ] ||
- ( outerCache[ elem.uniqueID ] = {} );
-
- if ( skip && skip === elem.nodeName.toLowerCase() ) {
+ if ( skip && nodeName( elem, skip ) ) {
elem = elem[ dir ] || elem;
- } else if ( ( oldCache = uniqueCache[ key ] ) &&
+ } else if ( ( oldCache = outerCache[ key ] ) &&
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
// Assign to newCache so results back-propagate to previous elements
@@ -2447,7 +2214,7 @@ function addCombinator( matcher, combinator, base ) {
} else {
// Reuse newcache so results back-propagate to previous elements
- uniqueCache[ key ] = newCache;
+ outerCache[ key ] = newCache;
// A match means we're done; a fail means we have to keep checking
if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
@@ -2479,7 +2246,7 @@ function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
- Sizzle( selector, contexts[ i ], results );
+ find( selector, contexts[ i ], results );
}
return results;
}
@@ -2513,38 +2280,37 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction( function( seed, results, context, xml ) {
- var temp, i, elem,
+ var temp, i, elem, matcherOut,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
- elems = seed || multipleContexts(
- selector || "*",
- context.nodeType ? [ context ] : context,
- []
- ),
+ elems = seed ||
+ multipleContexts( selector || "*",
+ context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
- elems,
+ elems;
- matcherOut = matcher ?
+ if ( matcher ) {
- // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
- postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
+ // If we have a postFinder, or filtered seed, or non-seed postFilter
+ // or preexisting results,
+ matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
- // ...intermediate processing is necessary
- [] :
+ // ...intermediate processing is necessary
+ [] :
- // ...otherwise use results directly
- results :
- matcherIn;
+ // ...otherwise use results directly
+ results;
- // Find primary matches
- if ( matcher ) {
+ // Find primary matches
matcher( matcherIn, matcherOut, context, xml );
+ } else {
+ matcherOut = matcherIn;
}
// Apply postFilter
@@ -2582,7 +2348,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
i = matcherOut.length;
while ( i-- ) {
if ( ( elem = matcherOut[ i ] ) &&
- ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
+ ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
seed[ temp ] = !( results[ temp ] = elem );
}
@@ -2617,15 +2383,21 @@ function matcherFromTokens( tokens ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
- return indexOf( checkContext, elem ) > -1;
+ return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
- var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+
+ // Support: IE 11+, Edge 17 - 18+
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
+ // two documents; shallow comparisons work.
+ // eslint-disable-next-line eqeqeq
+ var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || (
( checkContext = context ).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
- // Avoid hanging onto element (issue #299)
+ // Avoid hanging onto element
+ // (see https://github.com/jquery/sizzle/issues/299)
checkContext = null;
return ret;
} ];
@@ -2650,11 +2422,10 @@ function matcherFromTokens( tokens ) {
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector(
- // If the preceding token was a descendant combinator, insert an implicit any-element `*`
- tokens
- .slice( 0, i - 1 )
- .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
- ).replace( rtrim, "$1" ),
+ // If the preceding token was a descendant combinator, insert an implicit any-element `*`
+ tokens.slice( 0, i - 1 )
+ .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
+ ).replace( rtrimCSS, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
@@ -2680,7 +2451,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
contextBackup = outermostContext,
// We must always have either seed elements or outermost context
- elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
+ elems = seed || byElement && Expr.find.TAG( "*", outermost ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
@@ -2696,8 +2467,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
}
// Add elements passing elementMatchers directly to results
- // Support: IE<9, Safari
- // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id
+ // Support: iOS <=7 - 9 only
+ // Tolerate NodeList properties (IE: "length"; Safari: ) matching
+ // elements by id. (see trac-14142)
for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
@@ -2712,7 +2484,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
}
while ( ( matcher = elementMatchers[ j++ ] ) ) {
if ( matcher( elem, context || document, xml ) ) {
- results.push( elem );
+ push.call( results, elem );
break;
}
}
@@ -2775,7 +2547,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
- Sizzle.uniqueSort( results );
+ jQuery.uniqueSort( results );
}
}
@@ -2793,7 +2565,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
superMatcher;
}
-compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
+function compile( selector, match /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
@@ -2816,27 +2588,25 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
}
// Cache the compiled function
- cached = compilerCache(
- selector,
- matcherFromGroupMatchers( elementMatchers, setMatchers )
- );
+ cached = compilerCache( selector,
+ matcherFromGroupMatchers( elementMatchers, setMatchers ) );
// Save selector and tokenization
cached.selector = selector;
}
return cached;
-};
+}
/**
- * A low-level selection function that works with Sizzle's compiled
+ * A low-level selection function that works with jQuery's compiled
* selector functions
* @param {String|Function} selector A selector or a pre-compiled
- * selector function built with Sizzle.compile
+ * selector function built with jQuery selector compile
* @param {Element} context
* @param {Array} [results]
* @param {Array} [seed] A set of elements to match against
*/
-select = Sizzle.select = function( selector, context, results, seed ) {
+function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
compiled = typeof selector === "function" && selector,
match = !seed && tokenize( ( selector = compiled.selector || selector ) );
@@ -2850,10 +2620,12 @@ 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 ] ) {
+ context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
- context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
- .replace( runescape, funescape ), context ) || [] )[ 0 ];
+ context = ( Expr.find.ID(
+ token.matches[ 0 ].replace( runescape, funescape ),
+ context
+ ) || [] )[ 0 ];
if ( !context ) {
return results;
@@ -2866,7 +2638,7 @@ select = Sizzle.select = function( selector, context, results, seed ) {
}
// Fetch a seed set for right-to-left matching
- i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
+ i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[ i ];
@@ -2879,8 +2651,8 @@ select = Sizzle.select = function( selector, context, results, seed ) {
// Search, expanding context for leading sibling combinators
if ( ( seed = find(
token.matches[ 0 ].replace( runescape, funescape ),
- rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
- context
+ rsibling.test( tokens[ 0 ].type ) &&
+ testContext( context.parentNode ) || context
) ) ) {
// If seed is empty or no tokens remain, we can return early
@@ -2907,21 +2679,18 @@ select = Sizzle.select = function( selector, context, results, seed ) {
!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
);
return results;
-};
+}
// One-time assignments
+// Support: Android <=4.0 - 4.1+
// Sort stability
support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
-// Support: Chrome 14-35+
-// Always assume duplicates if they aren't passed to the comparison function
-support.detectDuplicates = !!hasDuplicate;
-
// Initialize against the default document
setDocument();
-// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
+// Support: Android <=4.0 - 4.1+
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert( function( el ) {
@@ -2929,68 +2698,29 @@ support.sortDetached = assert( function( el ) {
return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 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" ) === "#";
-} ) ) {
- addHandle( "type|href|height|width", function( elem, name, isXML ) {
- if ( !isXML ) {
- return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
- }
- } );
-}
-
-// 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" ) === "";
-} ) ) {
- addHandle( "value", function( elem, _name, isXML ) {
- if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
- return elem.defaultValue;
- }
- } );
-}
-
-// Support: IE<9
-// Use getAttributeNode to fetch booleans when getAttribute lies
-if ( !assert( function( el ) {
- return el.getAttribute( "disabled" ) == null;
-} ) ) {
- addHandle( booleans, function( elem, name, isXML ) {
- var val;
- if ( !isXML ) {
- return elem[ name ] === true ? name.toLowerCase() :
- ( val = elem.getAttributeNode( name ) ) && val.specified ?
- val.value :
- null;
- }
- } );
-}
-
-return Sizzle;
-
-} )( window );
-
-
-
-jQuery.find = Sizzle;
-jQuery.expr = Sizzle.selectors;
+jQuery.find = find;
// 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;
+jQuery.unique = jQuery.uniqueSort;
+
+// These have always been private, but they used to be documented as part of
+// Sizzle so let's maintain them for now for backwards compatibility purposes.
+find.compile = compile;
+find.select = select;
+find.setDocument = setDocument;
+find.tokenize = tokenize;
+
+find.escape = jQuery.escapeSelector;
+find.getText = jQuery.text;
+find.isXML = jQuery.isXMLDoc;
+find.selectors = jQuery.expr;
+find.support = jQuery.support;
+find.uniqueSort = jQuery.uniqueSort;
+ /* eslint-enable */
+} )();
var dir = function( elem, dir, until ) {
@@ -3024,13 +2754,6 @@ var siblings = function( n, elem ) {
var rneedsContext = jQuery.expr.match.needsContext;
-
-
-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 );
@@ -3129,8 +2852,8 @@ jQuery.fn.extend( {
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 <)
+ // Prioritize #id over to avoid XSS via location.hash (trac-9521)
+ // Strict HTML recognition (trac-11290: must start with <)
// Shortcut simple #id case for speed
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
@@ -3281,7 +3004,7 @@ jQuery.fn.extend( {
if ( cur.nodeType < 11 && ( targets ?
targets.index( cur ) > -1 :
- // Don't pass non-elements to Sizzle
+ // Don't pass non-elements to jQuery#find
cur.nodeType === 1 &&
jQuery.find.matchesSelector( cur, selectors ) ) ) {
@@ -3836,7 +3559,7 @@ jQuery.extend( {
if ( jQuery.Deferred.exceptionHook ) {
jQuery.Deferred.exceptionHook( e,
- process.stackTrace );
+ process.error );
}
// Support: Promises/A+ section 2.3.3.3.4.1
@@ -3864,10 +3587,17 @@ jQuery.extend( {
process();
} else {
- // Call an optional hook to record the stack, in case of exception
+ // Call an optional hook to record the error, in case of exception
// since it's otherwise lost when execution goes async
- if ( jQuery.Deferred.getStackHook ) {
- process.stackTrace = jQuery.Deferred.getStackHook();
+ if ( jQuery.Deferred.getErrorHook ) {
+ process.error = jQuery.Deferred.getErrorHook();
+
+ // The deprecated alias of the above. While the name suggests
+ // returning the stack, not an error instance, jQuery just passes
+ // it directly to `console.warn` so both will work; an instance
+ // just better cooperates with source maps.
+ } else if ( jQuery.Deferred.getStackHook ) {
+ process.error = jQuery.Deferred.getStackHook();
}
window.setTimeout( process );
}
@@ -4042,12 +3772,16 @@ jQuery.extend( {
// 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 ) {
+// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error
+// captured before the async barrier to get the original error cause
+// which may otherwise be hidden.
+jQuery.Deferred.exceptionHook = function( error, asyncError ) {
// 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 );
+ window.console.warn( "jQuery.Deferred exception: " + error.message,
+ error.stack, asyncError );
}
};
@@ -4087,7 +3821,7 @@ jQuery.extend( {
isReady: false,
// A counter to track how many items to wait for before
- // the ready event fires. See #6781
+ // the ready event fires. See trac-6781
readyWait: 1,
// Handle when the DOM is ready
@@ -4215,7 +3949,7 @@ function fcamelCase( _all, letter ) {
// 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)
+// Microsoft forgot to hump their vendor prefix (trac-9572)
function camelCase( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
}
@@ -4251,7 +3985,7 @@ Data.prototype = {
value = {};
// We can accept data for non-element nodes in modern browsers,
- // but we should not, see #8335.
+ // but we should not, see trac-8335.
// Always return an empty object.
if ( acceptData( owner ) ) {
@@ -4490,7 +4224,7 @@ jQuery.fn.extend( {
while ( i-- ) {
// Support: IE 11 only
- // The attrs elements can be null (#14894)
+ // The attrs elements can be null (trac-14894)
if ( attrs[ i ] ) {
name = attrs[ i ].name;
if ( name.indexOf( "data-" ) === 0 ) {
@@ -4913,9 +4647,9 @@ var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
input = document.createElement( "input" );
// Support: Android 4.0 - 4.3 only
- // Check state lost if the name is set (#11217)
+ // Check state lost if the name is set (trac-11217)
// Support: Windows Web Apps (WWA)
- // `name` and `type` must use .setAttribute for WWA (#14901)
+ // `name` and `type` must use .setAttribute for WWA (trac-14901)
input.setAttribute( "type", "radio" );
input.setAttribute( "checked", "checked" );
input.setAttribute( "name", "t" );
@@ -4939,7 +4673,7 @@ var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
} )();
-// We have to close these tags to support XHTML (#13200)
+// We have to close these tags to support XHTML (trac-13200)
var wrapMap = {
// XHTML parsers do not magically insert elements in the
@@ -4965,7 +4699,7 @@ if ( !support.option ) {
function getAll( context, tag ) {
// Support: IE <=9 - 11 only
- // Use typeof to avoid zero-argument method invocation on host objects (#15151)
+ // Use typeof to avoid zero-argument method invocation on host objects (trac-15151)
var ret;
if ( typeof context.getElementsByTagName !== "undefined" ) {
@@ -5048,7 +4782,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
// Remember the top-level container
tmp = fragment.firstChild;
- // Ensure the created nodes are orphaned (#12392)
+ // Ensure the created nodes are orphaned (trac-12392)
tmp.textContent = "";
}
}
@@ -5103,25 +4837,6 @@ function returnFalse() {
return false;
}
-// Support: IE <=9 - 11+
-// focus() and blur() are asynchronous, except when they are no-op.
-// So expect focus to be synchronous when the element is already active,
-// and blur to be synchronous when the element is not already active.
-// (focus and blur are always synchronous in other supported browsers,
-// this just defines when we can count on it).
-function expectSync( elem, type ) {
- return ( elem === safeActiveElement() ) === ( type === "focus" );
-}
-
-// Support: IE <=9 only
-// Accessing document.activeElement can throw unexpectedly
-// https://bugs.jquery.com/ticket/13393
-function safeActiveElement() {
- try {
- return document.activeElement;
- } catch ( err ) { }
-}
-
function on( elem, types, selector, data, fn, one ) {
var origFn, type;
@@ -5469,15 +5184,15 @@ jQuery.event = {
for ( ; cur !== this; cur = cur.parentNode || this ) {
- // Don't check non-elements (#13208)
- // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
+ // Don't check non-elements (trac-13208)
+ // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)
if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
matchedHandlers = [];
matchedSelectors = {};
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
- // Don't conflict with Object.prototype properties (#13203)
+ // Don't conflict with Object.prototype properties (trac-13203)
sel = handleObj.selector + " ";
if ( matchedSelectors[ sel ] === undefined ) {
@@ -5559,7 +5274,7 @@ jQuery.event = {
el.click && nodeName( el, "input" ) ) {
// dataPriv.set( el, "click", ... )
- leverageNative( el, "click", returnTrue );
+ leverageNative( el, "click", true );
}
// Return false to allow normal processing in the caller
@@ -5610,10 +5325,10 @@ jQuery.event = {
// synthetic events by interrupting progress until reinvoked in response to
// *native* events that it fires directly, ensuring that state changes have
// already occurred before other listeners are invoked.
-function leverageNative( el, type, expectSync ) {
+function leverageNative( el, type, isSetup ) {
- // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
- if ( !expectSync ) {
+ // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add
+ if ( !isSetup ) {
if ( dataPriv.get( el, type ) === undefined ) {
jQuery.event.add( el, type, returnTrue );
}
@@ -5625,15 +5340,13 @@ function leverageNative( el, type, expectSync ) {
jQuery.event.add( el, type, {
namespace: false,
handler: function( event ) {
- var notAsync, result,
+ var result,
saved = dataPriv.get( this, type );
if ( ( event.isTrigger & 1 ) && this[ type ] ) {
// Interrupt processing of the outer synthetic .trigger()ed event
- // Saved data should be false in such cases, but might be a leftover capture object
- // from an async native handler (gh-4350)
- if ( !saved.length ) {
+ if ( !saved ) {
// Store arguments for use when handling the inner native event
// There will always be at least one argument (an event object), so this array
@@ -5642,33 +5355,22 @@ function leverageNative( el, type, expectSync ) {
dataPriv.set( this, type, saved );
// Trigger the native event and capture its result
- // Support: IE <=9 - 11+
- // focus() and blur() are asynchronous
- notAsync = expectSync( this, type );
this[ type ]();
result = dataPriv.get( this, type );
- if ( saved !== result || notAsync ) {
- dataPriv.set( this, type, false );
- } else {
- result = {};
- }
+ dataPriv.set( this, type, false );
+
if ( saved !== result ) {
// Cancel the outer synthetic event
event.stopImmediatePropagation();
event.preventDefault();
- // Support: Chrome 86+
- // In Chrome, if an element having a focusout handler is blurred by
- // clicking outside of it, it invokes the handler synchronously. If
- // that handler calls `.remove()` on the element, the data is cleared,
- // leaving `result` undefined. We need to guard against this.
- return result && result.value;
+ return result;
}
// If this is an inner synthetic event for an event with a bubbling surrogate
- // (focus or blur), assume that the surrogate already propagated from triggering the
- // native event and prevent that from happening again here.
+ // (focus or blur), assume that the surrogate already propagated from triggering
+ // the native event and prevent that from happening again here.
// This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
// bubbling surrogate propagates *after* the non-bubbling base), but that seems
// less bad than duplication.
@@ -5678,22 +5380,25 @@ function leverageNative( el, type, expectSync ) {
// If this is a native event triggered above, everything is now in order
// Fire an inner synthetic event with the original arguments
- } else if ( saved.length ) {
+ } else if ( saved ) {
// ...and capture the result
- dataPriv.set( this, type, {
- value: jQuery.event.trigger(
-
- // Support: IE <=9 - 11+
- // Extend with the prototype to reset the above stopImmediatePropagation()
- jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
- saved.slice( 1 ),
- this
- )
- } );
-
- // Abort handling of the native event
- event.stopImmediatePropagation();
+ dataPriv.set( this, type, jQuery.event.trigger(
+ saved[ 0 ],
+ saved.slice( 1 ),
+ this
+ ) );
+
+ // Abort handling of the native event by all jQuery handlers while allowing
+ // native handlers on the same element to run. On target, this is achieved
+ // by stopping immediate propagation just on the jQuery event. However,
+ // the native event is re-wrapped by a jQuery one on each level of the
+ // propagation so the only way to stop it for jQuery is to stop it for
+ // everyone via native `stopPropagation()`. This is not a problem for
+ // focus/blur which don't bubble, but it does also stop click on checkboxes
+ // and radios. We accept this limitation.
+ event.stopPropagation();
+ event.isImmediatePropagationStopped = returnTrue;
}
}
} );
@@ -5731,7 +5436,7 @@ jQuery.Event = function( src, props ) {
// Create target properties
// Support: Safari <=6 - 7 only
- // Target should not be a text node (#504, #13143)
+ // Target should not be a text node (trac-504, trac-13143)
this.target = ( src.target && src.target.nodeType === 3 ) ?
src.target.parentNode :
src.target;
@@ -5832,18 +5537,73 @@ jQuery.each( {
}, jQuery.event.addProp );
jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
+
+ function focusMappedHandler( nativeEvent ) {
+ if ( document.documentMode ) {
+
+ // Support: IE 11+
+ // Attach a single focusin/focusout handler on the document while someone wants
+ // focus/blur. This is because the former are synchronous in IE while the latter
+ // are async. In other browsers, all those handlers are invoked synchronously.
+
+ // `handle` from private data would already wrap the event, but we need
+ // to change the `type` here.
+ var handle = dataPriv.get( this, "handle" ),
+ event = jQuery.event.fix( nativeEvent );
+ event.type = nativeEvent.type === "focusin" ? "focus" : "blur";
+ event.isSimulated = true;
+
+ // First, handle focusin/focusout
+ handle( nativeEvent );
+
+ // ...then, handle focus/blur
+ //
+ // focus/blur don't bubble while focusin/focusout do; simulate the former by only
+ // invoking the handler at the lower level.
+ if ( event.target === event.currentTarget ) {
+
+ // The setup part calls `leverageNative`, which, in turn, calls
+ // `jQuery.event.add`, so event handle will already have been set
+ // by this point.
+ handle( event );
+ }
+ } else {
+
+ // For non-IE browsers, attach a single capturing handler on the document
+ // while someone wants focusin/focusout.
+ jQuery.event.simulate( delegateType, nativeEvent.target,
+ jQuery.event.fix( nativeEvent ) );
+ }
+ }
+
jQuery.event.special[ type ] = {
// Utilize native event if possible so blur/focus sequence is correct
setup: function() {
+ var attaches;
+
// Claim the first handler
// dataPriv.set( this, "focus", ... )
// dataPriv.set( this, "blur", ... )
- leverageNative( this, type, expectSync );
+ leverageNative( this, type, true );
- // Return false to allow normal processing in the caller
- return false;
+ if ( document.documentMode ) {
+
+ // Support: IE 9 - 11+
+ // We use the same native handler for focusin & focus (and focusout & blur)
+ // so we need to coordinate setup & teardown parts between those events.
+ // Use `delegateType` as the key as `type` is already used by `leverageNative`.
+ attaches = dataPriv.get( this, delegateType );
+ if ( !attaches ) {
+ this.addEventListener( delegateType, focusMappedHandler );
+ }
+ dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 );
+ } else {
+
+ // Return false to allow normal processing in the caller
+ return false;
+ }
},
trigger: function() {
@@ -5854,14 +5614,84 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp
return true;
},
- // Suppress native focus or blur as it's already being fired
- // in leverageNative.
- _default: function() {
- return true;
+ teardown: function() {
+ var attaches;
+
+ if ( document.documentMode ) {
+ attaches = dataPriv.get( this, delegateType ) - 1;
+ if ( !attaches ) {
+ this.removeEventListener( delegateType, focusMappedHandler );
+ dataPriv.remove( this, delegateType );
+ } else {
+ dataPriv.set( this, delegateType, attaches );
+ }
+ } else {
+
+ // Return false to indicate standard teardown should be applied
+ return false;
+ }
+ },
+
+ // Suppress native focus or blur if we're currently inside
+ // a leveraged native-event stack
+ _default: function( event ) {
+ return dataPriv.get( event.target, type );
},
delegateType: delegateType
};
+
+ // Support: Firefox <=44
+ // Firefox doesn't have focus(in | out) events
+ // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
+ //
+ // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
+ // focus(in | out) events fire after focus & blur events,
+ // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
+ // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
+ //
+ // Support: IE 9 - 11+
+ // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,
+ // attach a single handler for both events in IE.
+ jQuery.event.special[ delegateType ] = {
+ setup: function() {
+
+ // Handle: regular nodes (via `this.ownerDocument`), window
+ // (via `this.document`) & document (via `this`).
+ var doc = this.ownerDocument || this.document || this,
+ dataHolder = document.documentMode ? this : doc,
+ attaches = dataPriv.get( dataHolder, delegateType );
+
+ // Support: IE 9 - 11+
+ // We use the same native handler for focusin & focus (and focusout & blur)
+ // so we need to coordinate setup & teardown parts between those events.
+ // Use `delegateType` as the key as `type` is already used by `leverageNative`.
+ if ( !attaches ) {
+ if ( document.documentMode ) {
+ this.addEventListener( delegateType, focusMappedHandler );
+ } else {
+ doc.addEventListener( type, focusMappedHandler, true );
+ }
+ }
+ dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 );
+ },
+ teardown: function() {
+ var doc = this.ownerDocument || this.document || this,
+ dataHolder = document.documentMode ? this : doc,
+ attaches = dataPriv.get( dataHolder, delegateType ) - 1;
+
+ if ( !attaches ) {
+ if ( document.documentMode ) {
+ this.removeEventListener( delegateType, focusMappedHandler );
+ } else {
+ doc.removeEventListener( type, focusMappedHandler, true );
+ }
+ dataPriv.remove( dataHolder, delegateType );
+ } else {
+ dataPriv.set( dataHolder, delegateType, attaches );
+ }
+ }
+ };
} );
// Create mouseenter/leave events using mouseover/out and event-time checks
@@ -5956,7 +5786,8 @@ var
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
- rcleanScript = /^\s*\s*$/g;
+
+ rcleanScript = /^\s*\s*$/g;
// Prefer a tbody over its parent table for containing new rows
function manipulationTarget( elem, content ) {
@@ -6070,7 +5901,7 @@ function domManip( collection, args, callback, ignored ) {
// Use the original fragment for the last item
// instead of the first because it can end up
- // being emptied incorrectly in certain situations (#8070).
+ // being emptied incorrectly in certain situations (trac-8070).
for ( ; i < l; i++ ) {
node = fragment;
@@ -6092,7 +5923,7 @@ function domManip( collection, args, callback, ignored ) {
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument;
- // Reenable scripts
+ // Re-enable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
@@ -6111,6 +5942,12 @@ function domManip( collection, args, callback, ignored ) {
}, doc );
}
} else {
+
+ // Unwrap a CDATA section containing script contents. This shouldn't be
+ // needed as in XML documents they're already not visible when
+ // inspecting element contents and in HTML documents they have no
+ // meaning but we're preserving that logic for backwards compatibility.
+ // This will be removed completely in 4.0. See gh-4904.
DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
}
}
@@ -6157,7 +5994,8 @@ 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 jQuery#find here for performance reasons:
+ // https://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
@@ -6393,9 +6231,12 @@ jQuery.each( {
} );
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
+var rcustomProp = /^--/;
+
+
var getStyles = function( elem ) {
- // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
+ // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150)
// IE throws on elements created in popups
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
var view = elem.ownerDocument.defaultView;
@@ -6495,7 +6336,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
}
// Support: IE <=9 - 11 only
- // Style of cloned element affects source element cloned (#8908)
+ // Style of cloned element affects source element cloned (trac-8908)
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
@@ -6539,7 +6380,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
trChild = document.createElement( "div" );
table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
- tr.style.cssText = "border:1px solid";
+ tr.style.cssText = "box-sizing:content-box;border:1px solid";
// Support: Chrome 86+
// Height set through cssText does not get applied.
@@ -6551,7 +6392,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
// In our bodyBackground.html iframe,
// display for all div elements is set to "inline",
// which causes a problem only in Android 8 Chrome 86.
- // Ensuring the div is display: block
+ // Ensuring the div is `display: block`
// gets around this issue.
trChild.style.display = "block";
@@ -6575,6 +6416,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
function curCSS( elem, name, computed ) {
var width, minWidth, maxWidth, ret,
+ isCustomProp = rcustomProp.test( name ),
// Support: Firefox 51+
// Retrieving style before computed somehow
@@ -6585,11 +6427,42 @@ function curCSS( elem, name, computed ) {
computed = computed || getStyles( elem );
// getPropertyValue is needed for:
- // .css('filter') (IE 9 only, #12537)
- // .css('--customProperty) (#3144)
+ // .css('filter') (IE 9 only, trac-12537)
+ // .css('--customProperty) (gh-3144)
if ( computed ) {
+
+ // Support: IE <=9 - 11+
+ // IE only supports `"float"` in `getPropertyValue`; in computed styles
+ // it's only available as `"cssFloat"`. We no longer modify properties
+ // sent to `.css()` apart from camelCasing, so we need to check both.
+ // Normally, this would create difference in behavior: if
+ // `getPropertyValue` returns an empty string, the value returned
+ // by `.css()` would be `undefined`. This is usually the case for
+ // disconnected elements. However, in IE even disconnected elements
+ // with no styles return `"none"` for `getPropertyValue( "float" )`
ret = computed.getPropertyValue( name ) || computed[ name ];
+ if ( isCustomProp && ret ) {
+
+ // Support: Firefox 105+, Chrome <=105+
+ // Spec requires trimming whitespace for custom properties (gh-4926).
+ // Firefox only trims leading whitespace. Chrome just collapses
+ // both leading & trailing whitespace to a single space.
+ //
+ // Fall back to `undefined` if empty string returned.
+ // This collapses a missing definition with property defined
+ // and set to an empty string but there's no standard API
+ // allowing us to differentiate them without a performance penalty
+ // and returning `undefined` aligns with older jQuery.
+ //
+ // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED
+ // as whitespace while CSS does not, but this is not a problem
+ // because CSS preprocessing replaces them with U+000A LINE FEED
+ // (which *is* CSS whitespace)
+ // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
+ ret = ret.replace( rtrimCSS, "$1" ) || undefined;
+ }
+
if ( ret === "" && !isAttached( elem ) ) {
ret = jQuery.style( elem, name );
}
@@ -6685,7 +6558,6 @@ var
// except "table", "table-cell", or "table-caption"
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
- rcustomProp = /^--/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: "0",
@@ -6707,7 +6579,8 @@ function setPositiveNumber( _elem, value, subtract ) {
function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
var i = dimension === "width" ? 1 : 0,
extra = 0,
- delta = 0;
+ delta = 0,
+ marginDelta = 0;
// Adjustment may not be necessary
if ( box === ( isBorderBox ? "border" : "content" ) ) {
@@ -6717,8 +6590,10 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
for ( ; i < 4; i += 2 ) {
// Both box models exclude margin
+ // Count margin delta separately to only add it after scroll gutter adjustment.
+ // This is needed to make negative margins work with `outerHeight( true )` (gh-3982).
if ( box === "margin" ) {
- delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
+ marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
}
// If we get here with a content-box, we're seeking "padding" or "border" or "margin"
@@ -6769,7 +6644,7 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
) ) || 0;
}
- return delta;
+ return delta + marginDelta;
}
function getWidthOrHeight( elem, dimension, extra ) {
@@ -6867,26 +6742,35 @@ jQuery.extend( {
// Don't automatically add "px" to these possibly-unitless properties
cssNumber: {
- "animationIterationCount": true,
- "columnCount": true,
- "fillOpacity": true,
- "flexGrow": true,
- "flexShrink": true,
- "fontWeight": true,
- "gridArea": true,
- "gridColumn": true,
- "gridColumnEnd": true,
- "gridColumnStart": true,
- "gridRow": true,
- "gridRowEnd": true,
- "gridRowStart": true,
- "lineHeight": true,
- "opacity": true,
- "order": true,
- "orphans": true,
- "widows": true,
- "zIndex": true,
- "zoom": true
+ animationIterationCount: true,
+ aspectRatio: true,
+ borderImageSlice: true,
+ columnCount: true,
+ flexGrow: true,
+ flexShrink: true,
+ fontWeight: true,
+ gridArea: true,
+ gridColumn: true,
+ gridColumnEnd: true,
+ gridColumnStart: true,
+ gridRow: true,
+ gridRowEnd: true,
+ gridRowStart: true,
+ lineHeight: true,
+ opacity: true,
+ order: true,
+ orphans: true,
+ scale: true,
+ widows: true,
+ zIndex: true,
+ zoom: true,
+
+ // SVG-related
+ fillOpacity: true,
+ floodOpacity: true,
+ stopOpacity: true,
+ strokeMiterlimit: true,
+ strokeOpacity: true
},
// Add in properties whose names you wish to fix before
@@ -6921,15 +6805,15 @@ jQuery.extend( {
if ( value !== undefined ) {
type = typeof value;
- // Convert "+=" or "-=" to relative numbers (#7345)
+ // Convert "+=" or "-=" to relative numbers (trac-7345)
if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
value = adjustCSS( elem, name, ret );
- // Fixes bug #9237
+ // Fixes bug trac-9237
type = "number";
}
- // Make sure that null and NaN values aren't set (#7116)
+ // Make sure that null and NaN values aren't set (trac-7116)
if ( value == null || value !== value ) {
return;
}
@@ -7553,7 +7437,7 @@ function Animation( elem, properties, options ) {
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// Support: Android 2.3 only
- // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
+ // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
@@ -7943,7 +7827,6 @@ jQuery.fx.speeds = {
// Based off of the plugin by Clint Helfers, with permission.
-// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
jQuery.fn.delay = function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
@@ -8168,8 +8051,7 @@ jQuery.extend( {
// Support: IE <=9 - 11 only
// elem.tabIndex doesn't always return the
// correct value when it hasn't been explicitly set
- // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- // Use proper attribute retrieval(#12072)
+ // Use proper attribute retrieval (trac-12072)
var tabindex = jQuery.find.attr( elem, "tabindex" );
if ( tabindex ) {
@@ -8273,8 +8155,7 @@ function classesToArray( value ) {
jQuery.fn.extend( {
addClass: function( value ) {
- var classes, elem, cur, curValue, clazz, j, finalValue,
- i = 0;
+ var classNames, cur, curValue, className, i, finalValue;
if ( isFunction( value ) ) {
return this.each( function( j ) {
@@ -8282,36 +8163,35 @@ jQuery.fn.extend( {
} );
}
- classes = classesToArray( value );
+ classNames = classesToArray( value );
- if ( classes.length ) {
- while ( ( elem = this[ i++ ] ) ) {
- curValue = getClass( elem );
- cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
+ if ( classNames.length ) {
+ return this.each( function() {
+ curValue = getClass( this );
+ cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
if ( cur ) {
- j = 0;
- while ( ( clazz = classes[ j++ ] ) ) {
- if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
- cur += clazz + " ";
+ for ( i = 0; i < classNames.length; i++ ) {
+ className = classNames[ i ];
+ if ( cur.indexOf( " " + className + " " ) < 0 ) {
+ cur += className + " ";
}
}
// Only assign if different to avoid unneeded rendering.
finalValue = stripAndCollapse( cur );
if ( curValue !== finalValue ) {
- elem.setAttribute( "class", finalValue );
+ this.setAttribute( "class", finalValue );
}
}
- }
+ } );
}
return this;
},
removeClass: function( value ) {
- var classes, elem, cur, curValue, clazz, j, finalValue,
- i = 0;
+ var classNames, cur, curValue, className, i, finalValue;
if ( isFunction( value ) ) {
return this.each( function( j ) {
@@ -8323,45 +8203,42 @@ jQuery.fn.extend( {
return this.attr( "class", "" );
}
- classes = classesToArray( value );
+ classNames = classesToArray( value );
- if ( classes.length ) {
- while ( ( elem = this[ i++ ] ) ) {
- curValue = getClass( elem );
+ if ( classNames.length ) {
+ return this.each( function() {
+ curValue = getClass( this );
// This expression is here for better compressibility (see addClass)
- cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
+ cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
if ( cur ) {
- j = 0;
- while ( ( clazz = classes[ j++ ] ) ) {
+ for ( i = 0; i < classNames.length; i++ ) {
+ className = classNames[ i ];
// Remove *all* instances
- while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
- cur = cur.replace( " " + clazz + " ", " " );
+ while ( cur.indexOf( " " + className + " " ) > -1 ) {
+ cur = cur.replace( " " + className + " ", " " );
}
}
// Only assign if different to avoid unneeded rendering.
finalValue = stripAndCollapse( cur );
if ( curValue !== finalValue ) {
- elem.setAttribute( "class", finalValue );
+ this.setAttribute( "class", finalValue );
}
}
- }
+ } );
}
return this;
},
toggleClass: function( value, stateVal ) {
- var type = typeof value,
+ var classNames, className, i, self,
+ type = typeof value,
isValidValue = type === "string" || Array.isArray( value );
- if ( typeof stateVal === "boolean" && isValidValue ) {
- return stateVal ? this.addClass( value ) : this.removeClass( value );
- }
-
if ( isFunction( value ) ) {
return this.each( function( i ) {
jQuery( this ).toggleClass(
@@ -8371,17 +8248,20 @@ jQuery.fn.extend( {
} );
}
- return this.each( function() {
- var className, i, self, classNames;
+ if ( typeof stateVal === "boolean" && isValidValue ) {
+ return stateVal ? this.addClass( value ) : this.removeClass( value );
+ }
+ classNames = classesToArray( value );
+
+ return this.each( function() {
if ( isValidValue ) {
// Toggle individual class names
- i = 0;
self = jQuery( this );
- classNames = classesToArray( value );
- while ( ( className = classNames[ i++ ] ) ) {
+ for ( i = 0; i < classNames.length; i++ ) {
+ className = classNames[ i ];
// Check each className given, space separated list
if ( self.hasClass( className ) ) {
@@ -8515,7 +8395,7 @@ jQuery.extend( {
val :
// Support: IE <=10 - 11 only
- // option.text throws exceptions (#14686, #14858)
+ // option.text throws exceptions (trac-14686, trac-14858)
// Strip and collapse whitespace
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
stripAndCollapse( jQuery.text( elem ) );
@@ -8542,7 +8422,7 @@ jQuery.extend( {
option = options[ i ];
// Support: IE <=9 only
- // IE8-9 doesn't update selected after form reset (#2551)
+ // IE8-9 doesn't update selected after form reset (trac-2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
@@ -8616,9 +8496,39 @@ jQuery.each( [ "radio", "checkbox" ], function() {
// Return jQuery for attributes-only inclusion
+var location = window.location;
+
+var nonce = { guid: Date.now() };
+var rquery = ( /\?/ );
+
+
+
+// Cross-browser xml parsing
+jQuery.parseXML = function( data ) {
+ var xml, parserErrorElem;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+
+ // Support: IE 9 - 11 only
+ // IE throws on parseFromString with invalid input.
+ try {
+ xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
+ } catch ( e ) {}
-support.focusin = "onfocusin" in window;
+ parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
+ if ( !xml || parserErrorElem ) {
+ jQuery.error( "Invalid XML: " + (
+ parserErrorElem ?
+ jQuery.map( parserErrorElem.childNodes, function( el ) {
+ return el.textContent;
+ } ).join( "\n" ) :
+ data
+ ) );
+ }
+ return xml;
+};
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
@@ -8685,8 +8595,8 @@ jQuery.extend( jQuery.event, {
return;
}
- // Determine event propagation path in advance, per W3C events spec (#9951)
- // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+ // Determine event propagation path in advance, per W3C events spec (trac-9951)
+ // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724)
if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
bubbleType = special.delegateType || type;
@@ -8738,7 +8648,7 @@ jQuery.extend( jQuery.event, {
acceptData( elem ) ) {
// Call a native DOM method on the target with the same name as the event.
- // Don't do default actions on window, that's where global variables be (#6170)
+ // Don't do default actions on window, that's where global variables be (trac-6170)
if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
@@ -8806,85 +8716,6 @@ jQuery.fn.extend( {
} );
-// Support: Firefox <=44
-// Firefox doesn't have focus(in | out) events
-// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
-//
-// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
-// focus(in | out) events fire after focus & blur events,
-// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
-// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
-if ( !support.focusin ) {
- jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
-
- // Attach a single capturing handler on the document while someone wants focusin/focusout
- var handler = function( event ) {
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
- };
-
- jQuery.event.special[ fix ] = {
- setup: function() {
-
- // Handle: regular nodes (via `this.ownerDocument`), window
- // (via `this.document`) & document (via `this`).
- var doc = this.ownerDocument || this.document || this,
- attaches = dataPriv.access( doc, fix );
-
- if ( !attaches ) {
- doc.addEventListener( orig, handler, true );
- }
- dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
- },
- teardown: function() {
- var doc = this.ownerDocument || this.document || this,
- attaches = dataPriv.access( doc, fix ) - 1;
-
- if ( !attaches ) {
- doc.removeEventListener( orig, handler, true );
- dataPriv.remove( doc, fix );
-
- } else {
- dataPriv.access( doc, fix, attaches );
- }
- }
- };
- } );
-}
-var location = window.location;
-
-var nonce = { guid: Date.now() };
-
-var rquery = ( /\?/ );
-
-
-
-// Cross-browser xml parsing
-jQuery.parseXML = function( data ) {
- var xml, parserErrorElem;
- if ( !data || typeof data !== "string" ) {
- return null;
- }
-
- // Support: IE 9 - 11 only
- // IE throws on parseFromString with invalid input.
- try {
- xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
- } catch ( e ) {}
-
- parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
- if ( !xml || parserErrorElem ) {
- jQuery.error( "Invalid XML: " + (
- parserErrorElem ?
- jQuery.map( parserErrorElem.childNodes, function( el ) {
- return el.textContent;
- } ).join( "\n" ) :
- data
- ) );
- }
- return xml;
-};
-
-
var
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
@@ -9012,7 +8843,7 @@ var
rantiCache = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
- // #7653, #8125, #8152: local protocol detection
+ // trac-7653, trac-8125, trac-8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
@@ -9035,7 +8866,7 @@ var
*/
transports = {},
- // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+ // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression
allTypes = "*/".concat( "*" ),
// Anchor tag for parsing the document origin
@@ -9106,7 +8937,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
-// Fixes #9887
+// Fixes trac-9887
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
@@ -9517,12 +9348,12 @@ jQuery.extend( {
deferred.promise( jqXHR );
// Add protocol if not provided (prefilters might expect it)
- // Handle falsy url in the settings object (#10093: consistency with old signature)
+ // Handle falsy url in the settings object (trac-10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || location.href ) + "" )
.replace( rprotocol, location.protocol + "//" );
- // Alias method option to type as per ticket #12004
+ // Alias method option to type as per ticket trac-12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
@@ -9565,7 +9396,7 @@ jQuery.extend( {
}
// We can fire global events as of now if asked to
- // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
+ // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118)
fireGlobals = jQuery.event && s.global;
// Watch for a new set of requests
@@ -9594,7 +9425,7 @@ jQuery.extend( {
if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
- // #9682: remove data so that it's not used in an eventual retry
+ // trac-9682: remove data so that it's not used in an eventual retry
delete s.data;
}
@@ -9867,7 +9698,7 @@ jQuery._evalUrl = function( url, options, doc ) {
return jQuery.ajax( {
url: url,
- // Make this explicit, since user can override this through ajaxSetup (#11264)
+ // Make this explicit, since user can override this through ajaxSetup (trac-11264)
type: "GET",
dataType: "script",
cache: true,
@@ -9976,7 +9807,7 @@ var xhrSuccessStatus = {
0: 200,
// Support: IE <=9 only
- // #1450: sometimes IE returns 1223 when it should be 204
+ // trac-1450: sometimes IE returns 1223 when it should be 204
1223: 204
},
xhrSupported = jQuery.ajaxSettings.xhr();
@@ -10048,7 +9879,7 @@ jQuery.ajaxTransport( function( options ) {
} else {
complete(
- // File: protocol always yields status 0; see #8605, #14207
+ // File: protocol always yields status 0; see trac-8605, trac-14207
xhr.status,
xhr.statusText
);
@@ -10109,7 +9940,7 @@ jQuery.ajaxTransport( function( options ) {
xhr.send( options.hasContent && options.data || null );
} catch ( e ) {
- // #14683: Only rethrow if this hasn't been notified as an error yet
+ // trac-14683: Only rethrow if this hasn't been notified as an error yet
if ( callback ) {
throw e;
}
@@ -10729,7 +10560,9 @@ jQuery.fn.extend( {
},
hover: function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ return this
+ .on( "mouseenter", fnOver )
+ .on( "mouseleave", fnOut || fnOver );
}
} );
@@ -10753,7 +10586,9 @@ jQuery.each(
// Support: Android <=4.0 only
// Make sure we trim BOM and NBSP
-var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
+// Require that the "whitespace run" starts from a non-whitespace
+// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
+var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
// Bind a function to a context, optionally partially applying any
// arguments.
@@ -10820,7 +10655,7 @@ jQuery.isNumeric = function( obj ) {
jQuery.trim = function( text ) {
return text == null ?
"" :
- ( text + "" ).replace( rtrim, "" );
+ ( text + "" ).replace( rtrim, "$1" );
};
@@ -10868,8 +10703,8 @@ jQuery.noConflict = function( deep ) {
};
// Expose jQuery and $ identifiers, even in AMD
-// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
-// and CommonJS for browser emulators (#13566)
+// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557)
+// and CommonJS for browser emulators (trac-13566)
if ( typeof noGlobal === "undefined" ) {
window.jQuery = window.$ = jQuery;
}
@@ -10881,7 +10716,7 @@ return jQuery;
} );
/*!
- * jQuery Migrate - v3.3.2 - 2020-11-17T23:22Z
+ * jQuery Migrate - v3.5.2 - 2020-11-17T23:22Z
* Copyright OpenJS Foundation and other contributors
*/
( function( factory ) {
@@ -10906,7 +10741,7 @@ return jQuery;
} )( function( jQuery, window ) {
"use strict";
-jQuery.migrateVersion = "3.3.2";
+jQuery.migrateVersion = "3.5.2";
jQuery.migrateMute = true;
// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
diff --git a/frontend/express/public/javascripts/utils/additional-methods.js b/frontend/express/public/javascripts/utils/additional-methods.js
index bc1ef39ed61..ed754644b57 100644
--- a/frontend/express/public/javascripts/utils/additional-methods.js
+++ b/frontend/express/public/javascripts/utils/additional-methods.js
@@ -1,9 +1,9 @@
/*!
- * jQuery Validation Plugin v1.19.6-pre
+ * jQuery Validation Plugin v1.21.0
*
* https://jqueryvalidation.org/
*
- * Copyright (c) 2023 Jörn Zaefferer
+ * Copyright (c) 2024 Jörn Zaefferer
* Released under the MIT license
*/
(function( factory ) {
diff --git a/frontend/express/public/javascripts/utils/jquery.validate.js b/frontend/express/public/javascripts/utils/jquery.validate.js
index 4adbbeb34d9..e54cd1dc48f 100644
--- a/frontend/express/public/javascripts/utils/jquery.validate.js
+++ b/frontend/express/public/javascripts/utils/jquery.validate.js
@@ -1,9 +1,9 @@
/*!
- * jQuery Validation Plugin v1.19.6-pre
+ * jQuery Validation Plugin v1.21.0
*
* https://jqueryvalidation.org/
*
- * Copyright (c) 2023 Jörn Zaefferer
+ * Copyright (c) 2024 Jörn Zaefferer
* Released under the MIT license
*/
(function( factory ) {
@@ -293,6 +293,7 @@ $.extend( $.validator, {
onsubmit: true,
ignore: ":hidden",
ignoreTitle: false,
+ customElements: [],
onfocusin: function( element ) {
this.lastActive = element;
@@ -440,17 +441,17 @@ $.extend( $.validator, {
settings[ eventType ].call( validator, this, event );
}
}
-
+ var focusListeners = [ ":text", "[type='password']", "[type='file']", "select", "textarea", "[type='number']", "[type='search']",
+ "[type='tel']", "[type='url']", "[type='email']", "[type='datetime']", "[type='date']", "[type='month']",
+ "[type='week']", "[type='time']", "[type='datetime-local']", "[type='range']", "[type='color']",
+ "[type='radio']", "[type='checkbox']", "[contenteditable]", "[type='button']" ];
+ var clickListeners = [ "select", "option", "[type='radio']", "[type='checkbox']" ];
$( this.currentForm )
- .on( "focusin.validate focusout.validate keyup.validate",
- ":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " +
- "[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " +
- "[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " +
- "[type='radio'], [type='checkbox'], [contenteditable], [type='button']", delegate )
+ .on( "focusin.validate focusout.validate keyup.validate", focusListeners.concat( this.settings.customElements ).join( ", " ), delegate )
// Support: Chrome, oldIE
// "select" is provided as event.target when clicking a option
- .on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate );
+ .on( "click.validate", clickListeners.concat( this.settings.customElements ).join( ", " ), delegate );
if ( this.settings.invalidHandler ) {
$( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
@@ -647,11 +648,12 @@ $.extend( $.validator, {
elements: function() {
var validator = this,
- rulesCache = {};
+ rulesCache = {},
+ selectors = [ "input", "select", "textarea", "[contenteditable]" ];
// Select all valid inputs inside the form (no submit or reset buttons)
return $( this.currentForm )
- .find( "input, select, textarea, [contenteditable]" )
+ .find( selectors.concat( this.settings.customElements ).join( ", " ) )
.not( ":submit, :reset, :image, :disabled" )
.not( this.settings.ignore )
.filter( function() {
@@ -1501,7 +1503,7 @@ $.extend( $.validator, {
// https://jqueryvalidation.org/number-method/
number: function( value, element ) {
- return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
+ return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/.test( value );
},
// https://jqueryvalidation.org/digits-method/
@@ -1612,11 +1614,12 @@ $.extend( $.validator, {
param = typeof param === "string" && { url: param } || param;
optionDataString = $.param( $.extend( { data: value }, param.data ) );
- if ( previous.old === optionDataString ) {
+ if ( previous.valid !== null && previous.old === optionDataString ) {
return previous.valid;
}
previous.old = optionDataString;
+ previous.valid = null;
validator = this;
this.startRequest( element );
data = {};
diff --git a/plugins/errorlogs/frontend/public/javascripts/countly.views.js b/plugins/errorlogs/frontend/public/javascripts/countly.views.js
index ff0c3547d5d..654c47f61d9 100644
--- a/plugins/errorlogs/frontend/public/javascripts/countly.views.js
+++ b/plugins/errorlogs/frontend/public/javascripts/countly.views.js
@@ -6,8 +6,9 @@
data: function() {
return {
selectLog: this.query || "api",
- downloadLink: countlyGlobal.path + "/o/errorlogs?auth_token=" + countlyGlobal.auth_token + "&download=true&log=" + this.query || "api",
+ downloadLink: countlyGlobal.path + "/o/errorlogs?download=true&log=" + this.query || "api",
logList: [{name: "Api Log", value: "api"}],
+ authToken: countlyGlobal.auth_token,
cachedLog: {}
};
},
@@ -35,7 +36,7 @@
}
},
changeLog: function(value) {
- this.downloadLink = countlyGlobal.path + "/o/errorlogs?auth_token=" + countlyGlobal.auth_token + "&download=true&log=" + value,
+ this.downloadLink = countlyGlobal.path + "/o/errorlogs?download=true&log=" + value,
app.navigate("#/manage/logs/errorlogs/" + value);
this.refresh(true);
},
@@ -58,6 +59,10 @@
}
});
}, [jQuery.i18n.map["common.no-dont-delete"], jQuery.i18n.map["common.yes-clear-it"]], {title: jQuery.i18n.map["errorlogs.confirm-delete-" + self.selectLog + "-title"] || jQuery.i18n.map["errorlogs.confirm-delete-title"], image: "clear-api-logs"});
+ },
+ download: function() {
+ document.forms.errorlogsform.submit();
+ return false;
}
}
});
diff --git a/plugins/errorlogs/frontend/public/templates/logs.html b/plugins/errorlogs/frontend/public/templates/logs.html
index c1d40870e0e..9be102fd5b5 100644
--- a/plugins/errorlogs/frontend/public/templates/logs.html
+++ b/plugins/errorlogs/frontend/public/templates/logs.html
@@ -15,7 +15,10 @@
{{i18n('errorlogs.clear')}}
-
+
+
{{i18n('errorlogs.download')}}