1/** 2 * jQuery 4 compatibility shim for the bundled plugins. 3 * 4 * jQuery 4.0 removed $.camelCase, $.type, $.isFunction, $.isArray, $.trim, 5 * $.isNumeric, $.isWindow and $.now. Bootstrap 3.4.1's collapse plugin -- the 6 * mobile menu -- calls $.camelCase every time it opens, its tooltips call 7 * $.isFunction and its scrollspy $.isWindow. 8 * 9 * The event aliases (.bind(), .delegate(), .hover(), ...) are only deprecated 10 * in 4.0 and still ship, but FlexSlider calls them and a later major or the 11 * slim build drops them, so they are covered too. 12 * 13 * Every definition is guarded, so on jQuery 3.x this file does nothing. Not 14 * `.load()`, which was both an AJAX method and an event alias and cannot be 15 * shimmed unambiguously. 16 * 17 * @package sparkling 18 */ 19( function ( $ ) { 20 'use strict'; 21 22 if ( ! $ || ! $.fn ) { 23 return; 24 } 25 26 if ( 'function' !== typeof $.fn.bind ) { 27 $.fn.bind = function ( types, data, fn ) { 28 return this.on( types, null, data, fn ); 29 }; 30 } 31 32 if ( 'function' !== typeof $.fn.unbind ) { 33 $.fn.unbind = function ( types, fn ) { 34 return this.off( types, null, fn ); 35 }; 36 } 37 38 if ( 'function' !== typeof $.fn.delegate ) { 39 // Note the argument order flip: .delegate(selector, types, ...) maps to 40 // .on(types, selector, ...). 41 $.fn.delegate = function ( selector, types, data, fn ) { 42 return this.on( types, selector, data, fn ); 43 }; 44 } 45 46 if ( 'function' !== typeof $.fn.undelegate ) { 47 $.fn.undelegate = function ( selector, types, fn ) { 48 return 1 === arguments.length ? 49 this.off( selector, '**' ) : 50 this.off( types, selector || '**', fn ); 51 }; 52 } 53 54 /* 55 * The per-event shorthand methods. Any third-party widget may use them. 56 */ 57 'blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu' 58 .split( ' ' ) 59 .forEach( function ( name ) { 60 if ( 'function' !== typeof $.fn[ name ] ) { 61 $.fn[ name ] = function ( data, fn ) { 62 return arguments.length > 0 ? 63 this.on( name, null, data, fn ) : 64 this.trigger( name ); 65 }; 66 } 67 } ); 68 69 if ( 'function' !== typeof $.fn.hover ) { 70 $.fn.hover = function ( fnOver, fnOut ) { 71 return this.on( 'mouseenter', fnOver ).on( 'mouseleave', fnOut || fnOver ); 72 }; 73 } 74 75 /* 76 * Utilities removed in jQuery 4. Bootstrap uses $.camelCase(), 77 * $.isFunction() and $.isWindow(); the others travel together in older 78 * plugins. 79 */ 80 if ( 'function' !== typeof $.type ) { 81 var class2type = {}; 82 'Boolean Number String Function Array Date RegExp Object Error Symbol' 83 .split( ' ' ) 84 .forEach( function ( name ) { 85 class2type[ '[object ' + name + ']' ] = name.toLowerCase(); 86 } ); 87 88 $.type = function ( obj ) { 89 if ( null == obj ) { 90 return obj + ''; 91 } 92 return 'object' === typeof obj || 'function' === typeof obj ? 93 class2type[ Object.prototype.toString.call( obj ) ] || 'object' : 94 typeof obj; 95 }; 96 } 97 98 if ( 'function' !== typeof $.isFunction ) { 99 $.isFunction = function ( obj ) { 100 return 'function' === typeof obj && 'number' !== typeof obj.nodeType; 101 }; 102 } 103 104 if ( 'function' !== typeof $.isArray ) { 105 $.isArray = Array.isArray; 106 } 107 108 if ( 'function' !== typeof $.trim ) { 109 $.trim = function ( text ) { 110 return null == text ? '' : ( text + '' ).replace( /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '' ); 111 }; 112 } 113 114 if ( 'function' !== typeof $.isNumeric ) { 115 $.isNumeric = function ( obj ) { 116 var type = $.type( obj ); 117 return ( 'number' === type || 'string' === type ) && ! isNaN( obj - parseFloat( obj ) ); 118 }; 119 } 120 121 if ( 'function' !== typeof $.camelCase ) { 122 // jQuery 3's implementation, including its "-ms-" special case. 123 $.camelCase = function ( string ) { 124 return String( string ).replace( /^-ms-/, 'ms-' ).replace( /-([a-z])/g, function ( all, letter ) { 125 return letter.toUpperCase(); 126 } ); 127 }; 128 } 129 130 if ( 'function' !== typeof $.isWindow ) { 131 $.isWindow = function ( obj ) { 132 return null != obj && obj === obj.window; 133 }; 134 } 135 136 if ( 'function' !== typeof $.now ) { 137 $.now = Date.now; 138 } 139}( jQuery ) );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.