: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// Includes all common event props including KeyEvent and MouseEvent specific props
}, jQuery.event.addProp );
jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
function focusMappedHandler( nativeEvent ) {
if ( document.documentMode ) {
// 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
// ...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
// 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
// Claim the first handler
// dataPriv.set( this, "focus", ... )
// dataPriv.set( this, "blur", ... )
leverageNative( this, type, true );
if ( document.documentMode ) {
// 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 );
this.addEventListener( delegateType, focusMappedHandler );
dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 );
// Return false to allow normal processing in the caller
// Force setup before trigger
leverageNative( this, type );
// Return non-false to allow normal event-path propagation
if ( document.documentMode ) {
attaches = dataPriv.get( this, delegateType ) - 1;
this.removeEventListener( delegateType, focusMappedHandler );
dataPriv.remove( this, delegateType );
dataPriv.set( this, delegateType, attaches );
// Return false to indicate standard teardown should be applied
// 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
// 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
// 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 ] = {
// 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 );
// 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 ( document.documentMode ) {
this.addEventListener( delegateType, focusMappedHandler );
doc.addEventListener( type, focusMappedHandler, true );
dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 );
var doc = this.ownerDocument || this.document || this,
dataHolder = document.documentMode ? this : doc,
attaches = dataPriv.get( dataHolder, delegateType ) - 1;
if ( document.documentMode ) {
this.removeEventListener( delegateType, focusMappedHandler );
doc.removeEventListener( type, focusMappedHandler, true );
dataPriv.remove( dataHolder, delegateType );
dataPriv.set( dataHolder, delegateType, attaches );
// Create mouseenter/leave events using mouseover/out and event-time checks
// so that event delegation works in jQuery.
// Do the same for pointerenter/pointerleave and pointerover/pointerout
// Support: Safari 7 only
// Safari sends mouseenter too often; see:
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
// for the description of the bug (it existed in older Chrome versions as well).
pointerenter: "pointerover",
pointerleave: "pointerout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
handle: function( event ) {
related = event.relatedTarget,
handleObj = event.handleObj;
// For mouseenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
on: function( types, selector, data, fn ) {
return on( this, types, selector, data, fn );
one: function( types, selector, data, fn ) {
return on( this, types, selector, data, fn, 1 );
off: function( types, selector, fn ) {
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.origType + "." + handleObj.namespace :
if ( typeof types === "object" ) {
// ( types-object [, selector] )
this.off( type, selector, types[ type ] );
if ( selector === false || typeof selector === "function" ) {
return this.each( function() {
jQuery.event.remove( this, types, fn, selector );
// Support: IE <=10 - 11, Edge 12 - 13 only
// In IE/Edge using regex groups here causes severe slowdowns.
// See https://connect.microsoft.com/IE/feedback/details/1736512/
rnoInnerhtml = /<script|<style|<link/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
// Prefer a tbody over its parent table for containing new rows
function manipulationTarget( elem, content ) {
if ( nodeName( elem, "table" ) &&
nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
function restoreScript( elem ) {
if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
elem.type = elem.type.slice( 5 );
elem.removeAttribute( "type" );
function cloneCopyEvent( src, dest ) {
var i, l, type, pdataOld, udataOld, udataCur, events;
if ( dest.nodeType !== 1 ) {
// 1. Copy private data: events, handlers, etc.
if ( dataPriv.hasData( src ) ) {
pdataOld = dataPriv.get( src );
events = pdataOld.events;
dataPriv.remove( dest, "handle events" );
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
if ( dataUser.hasData( src ) ) {
udataOld = dataUser.access( src );
udataCur = jQuery.extend( {}, udataOld );
dataUser.set( dest, udataCur );
// Fix IE bugs, see support tests
function fixInput( src, dest ) {
var nodeName = dest.nodeName.toLowerCase();
// Fails to persist the checked state of a cloned checkbox or radio button.
if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
dest.checked = src.checked;
// Fails to return the selected option to the default selected state when cloning options
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
function domManip( collection, args, callback, ignored ) {
// Flatten any nested arrays
var fragment, first, scripts, hasScripts, node, doc,
valueIsFunction = isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
( l > 1 && typeof value === "string" &&
!support.checkClone && rchecked.test( value ) ) ) {
return collection.each( function( index ) {
var self = collection.eq( index );
args[ 0 ] = value.call( this, index, self.html() );
domManip( self, args, callback, ignored );
fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
// Require either new content or an interest in ignored elements to invoke the callback
if ( first || ignored ) {
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item
// instead of the first because it can end up
// being emptied incorrectly in certain situations (trac-8070).
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for later restoration
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( scripts, getAll( node, "script" ) );
callback.call( collection[ i ], node, i );
doc = scripts[ scripts.length - 1 ].ownerDocument;
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
for ( i = 0; i < hasScripts; i++ ) {
if ( rscriptType.test( node.type || "" ) &&
!dataPriv.access( node, "globalEval" ) &&
jQuery.contains( doc, node ) ) {
if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
// Optional AJAX dependency, but won't run scripts if not present
if ( jQuery._evalUrl && !node.noModule ) {
jQuery._evalUrl( node.src, {
nonce: node.nonce || node.getAttribute( "nonce" )
// 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 );
function remove( elem, selector, keepData ) {
nodes = selector ? jQuery.filter( selector, elem ) : elem,
for ( ; ( node = nodes[ i ] ) != null; i++ ) {
if ( !keepData && node.nodeType === 1 ) {
jQuery.cleanData( getAll( node ) );
if ( keepData && isAttached( node ) ) {
setGlobalEval( getAll( node, "script" ) );
node.parentNode.removeChild( node );
htmlPrefilter: function( html ) {
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var i, l, srcElements, destElements,
clone = elem.cloneNode( true ),
inPage = isAttached( elem );
if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
!jQuery.isXMLDoc( elem ) ) {
// We eschew jQuery#find here for performance reasons:
// https://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );