: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// 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 );
while ( ( elem = results[ i++ ] ) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
splice.call( results, duplicates[ j ], 1 );
// Clear input after sorting to release objects
// See https://github.com/jquery/sizzle/pull/225
jQuery.fn.uniqueSort = function() {
return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
// Can be adjusted by the user
createPseudo: markFunction,
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
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 );
if ( match[ 2 ] === "~=" ) {
match[ 3 ] = " " + match[ 3 ] + " ";
return match.slice( 0, 4 );
CHILD: function( match ) {
/* matches from matchExpr["CHILD"]
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
match[ 1 ] = match[ 1 ].toLowerCase();
if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
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" )
match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
// other types prohibit arguments
} else if ( match[ 3 ] ) {
find.error( match[ 0 ] );
PSEUDO: function( match ) {
unquoted = !match[ 6 ] && match[ 2 ];
if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
// Accept quoted arguments as-is
match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
( excess = tokenize( unquoted, true ) ) &&
// advance to the next closing parenthesis
( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
// excess is a negative index
match[ 0 ] = match[ 0 ].slice( 0, excess );
match[ 2 ] = unquoted.slice( 0, excess );
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
TAG: function( nodeNameSelector ) {
var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
return nodeNameSelector === "*" ?
return nodeName( elem, expectedNodeName );
CLASS: function( className ) {
var pattern = classCache[ className + " " ];
( pattern = new RegExp( "(^|" + whitespace + ")" + className +
"(" + whitespace + "|$)" ) ) &&
classCache( className, function( elem ) {
typeof elem.className === "string" && elem.className ||
typeof elem.getAttribute !== "undefined" &&
elem.getAttribute( "class" ) ||
ATTR: function( name, operator, check ) {
return function( elem ) {
var result = find.attr( elem, name );
return operator === "!=";
if ( operator === "=" ) {
if ( operator === "!=" ) {
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, " " ) + " " )
if ( operator === "|=" ) {
return result === check || result.slice( 0, check.length + 1 ) === check + "-";
CHILD: function( type, what, _argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
return !!elem.parentNode;
function( elem, _context, xml ) {
var cache, outerCache, node, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType,
// :(first|last|only)-(child|of-type)
while ( ( node = node[ dir ] ) ) {
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
outerCache = parent[ expando ] || ( parent[ expando ] = {} );
cache = outerCache[ type ] || [];
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
diff = nodeIndex && cache[ 2 ];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( ( node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
( diff = nodeIndex = 0 ) || start.pop() ) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
// Use previously-cached element index if available
outerCache = elem[ expando ] || ( elem[ expando ] = {} );
cache = outerCache[ type ] || [];
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
// or :nth-last-child(...) or :nth(-last)?-of-type(...)
// Use the same loop as above to seek `elem` from the start
while ( ( node = ++nodeIndex && node && node[ dir ] ||
( diff = nodeIndex = 0 ) || start.pop() ) ) {
// Cache the index of each encountered element
outerCache = node[ expando ] ||
( node[ expando ] = {} );
outerCache[ type ] = [ dirruns, diff ];
// Incorporate the offset, then check against cycle size
return diff === first || ( diff % first === 0 && diff / first >= 0 );
PSEUDO: function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// 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
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
find.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// But maintain support for old signatures
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction( function( seed, matches ) {
matched = fn( seed, argument ),
idx = indexOf.call( seed, matched[ i ] );
seed[ idx ] = !( matches[ idx ] = matched[ i ] );
return fn( elem, 0, args );
// Potentially complex pseudos
not: markFunction( function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
matcher = compile( selector.replace( rtrimCSS, "$1" ) );
return matcher[ expando ] ?
markFunction( function( seed, matches, _context, xml ) {
unmatched = matcher( seed, null, xml, [] ),
// Match elements unmatched by `matcher`
if ( ( elem = unmatched[ i ] ) ) {
seed[ i ] = !( matches[ i ] = elem );
function( elem, _context, xml ) {
matcher( input, null, xml, results );
// Don't keep the element
// (see https://github.com/jquery/sizzle/issues/299)
has: markFunction( function( selector ) {
return function( elem ) {
return find( selector, elem ).length > 0;
contains: markFunction( function( text ) {
text = text.replace( runescape, funescape );
return function( elem ) {
return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// 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."
// https://www.w3.org/TR/selectors/#lang-pseudo
lang: markFunction( function( lang ) {
// lang value must be a valid identifier
if ( !ridentifier.test( lang || "" ) ) {
find.error( "unsupported lang: " + lang );
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
if ( ( elemLang = documentIsHTML ?
elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
} while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
target: function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
return elem === documentElement;
focus: function( elem ) {
return elem === safeActiveElement() &&
!!( elem.type || elem.href || ~elem.tabIndex );
enabled: createDisabledPseudo( false ),
disabled: createDisabledPseudo( true ),
checked: function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// 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 ) {
// Accessing the selectedIndex property
// forces the browser to treat the default option as
// selected when in an optgroup.
// eslint-disable-next-line no-unused-expressions
elem.parentNode.selectedIndex;
return elem.selected === true;
empty: function( elem ) {
// 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
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeType < 6 ) {
parent: function( elem ) {
return !Expr.pseudos.empty( elem );
header: function( elem ) {
return rheader.test( elem.nodeName );
input: function( elem ) {
return rinputs.test( elem.nodeName );
button: function( elem ) {