From d43309947e26fcc8695bc95582c5789b4bf4098e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Mon, 19 Jan 2026 18:39:22 +0200 Subject: [PATCH] fix(client): polyfill removed jQuery methods --- apps/client/src/index.ts | 11 +++++++++++ apps/client/src/runtime.ts | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/apps/client/src/index.ts b/apps/client/src/index.ts index 795adc8cfd..f4560fa3aa 100644 --- a/apps/client/src/index.ts +++ b/apps/client/src/index.ts @@ -16,6 +16,17 @@ async function initJQuery() { const $ = (await import("jquery")).default; window.$ = $; window.jQuery = $; + + // Polyfill removed jQuery methods for autocomplete.js compatibility + ($ as any).isArray = Array.isArray; + ($ as any).isFunction = function(obj: any) { return typeof obj === 'function'; }; + ($ as any).isPlainObject = function(obj: any) { + if (obj == null || typeof obj !== 'object') { return false; } + const proto = Object.getPrototypeOf(obj); + if (proto === null) { return true; } + const Ctor = Object.prototype.hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor === 'function' && Ctor === Object; + }; } async function setupGlob() { diff --git a/apps/client/src/runtime.ts b/apps/client/src/runtime.ts index 4c82481b17..cab174a76d 100644 --- a/apps/client/src/runtime.ts +++ b/apps/client/src/runtime.ts @@ -8,6 +8,17 @@ async function loadBootstrap() { } } +// Polyfill removed jQuery methods for autocomplete.js compatibility +($ as any).isArray = Array.isArray; +($ as any).isFunction = function(obj: any) { return typeof obj === 'function'; }; +($ as any).isPlainObject = function(obj: any) { + if (obj == null || typeof obj !== 'object') { return false; } + const proto = Object.getPrototypeOf(obj); + if (proto === null) { return true; } + const Ctor = Object.prototype.hasOwnProperty.call(proto, 'constructor') && proto.constructor; + return typeof Ctor === 'function' && Ctor === Object; +}; + (window as any).$ = $; (window as any).jQuery = $; await loadBootstrap();