PageSourceSearch

https://visugallery.com/lib/jquery/3.7.1/plugins/jquery.compat.sel…=f9c725e&g=a8296fbd127932420a4754b308bbc24b

js visugallery.com collected 2026-09-28 23:28:29 UTC 1,560 bytes, 38 lines download raw bytes

1/*!
2 * jQuery 3 compatibility shim: restores $.fn.selector
3 *
4 * jQuery 3.0 removed the .selector property on jQuery objects. Some plugins
5 * still in production use (notably fancybox 2.1.3 loaded by lib-g) check
6 * `this.selector` to decide between direct binding and document-level event
7 * delegation. Without .selector they fall back to direct binding, which
8 * misses dynamically-added elements such as slick carousel clones.
9 *
10 * This shim restores .selector to its jQuery 1.x behaviour:
11 *   - $('.foo').selector  === '.foo'
12 *   - $('.foo').find('.bar').selector  === ''   (matches jQuery 3 no-tracking)
13 *
14 * No-op when .selector is already present (e.g. jQuery 1.x).
15 */
16(function ($) {
17    if (!$ || !$.fn) { return; }
18    if ('selector' in $.fn) { return; }
19
20    // Default property on the prototype so $.fn.selector !== undefined.
21    $.fn.selector = '';
22
23    // Wrap $.fn.init so each new jQuery instance carries .selector when
24    // created via $('selector string'). Other init forms (DOM nodes,
25    // jQuery objects, functions) leave .selector at the default ''.
26    var origInit = $.fn.init;
27    var wrappedInit = function (selector, context, root) {
28        var instance = origInit.apply(this, arguments);
29        if (typeof selector === 'string') {
30            instance.selector = selector;
31        } else if (selector && typeof selector.selector === 'string') {
32            instance.selector = selector.selector;
33        }
34        return instance;
35    };
36    wrappedInit.prototype = $.fn;
37    $.fn.init = wrappedInit;
38})(window.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.