discourse/app/assets/javascripts/patches/@ember+jquery+2.0.0.patch
NullVoxPopuli c320c286f9
DEV: Use patch-package to apply ember-jquery workaround
Co-authored-by: David Taylor <david@taylorhq.com>
2023-04-11 10:12:30 +01:00

33 lines
1.3 KiB
Diff

diff --git a/node_modules/@ember/jquery/vendor/jquery/component.dollar.js b/node_modules/@ember/jquery/vendor/jquery/component.dollar.js
index 8c0cfd5..4c211e2 100644
--- a/node_modules/@ember/jquery/vendor/jquery/component.dollar.js
+++ b/node_modules/@ember/jquery/vendor/jquery/component.dollar.js
@@ -1,8 +1,16 @@
import { assert, deprecate } from '@ember/debug';
-import EmberObject from '@ember/object';
-import Component from '@ember/component';
(function() {
+ // importing these, specifically, is done so that we don't trigger the
+ // ember-global deprecation
+ //
+ // We had tried to import at the top of this file, but there is a build time transform
+ // removing those, and re-triggering the ember-global deprecation.
+ // See: https://deprecations.emberjs.com/v3.x#toc_ember-global
+ // for more information
+ const EmberObject = require("@ember/object").default;
+ const Component = require("@ember/component").default;
+
/*
* This non-standard use of `reopen` and `call` allows the component
* base class to be reopened without triggering the
@@ -28,6 +36,8 @@ import Component from '@ember/component';
);
if (this.element) {
+ // same technique the shim uses
+ let jQuery = self['jQuery'];
return sel ? jQuery(sel, this.element) : jQuery(this.element);
}
}