js: Prefix jQuery object variable names with $.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2022-01-25 02:36:19 -08:00
parent f21842e920
commit f84a2c08d5
195 changed files with 4883 additions and 4835 deletions

View File

@@ -43,8 +43,8 @@ function make_zjquery() {
const fn = {};
function new_elem(selector, create_opts) {
const elem = FakeElement(selector, {...create_opts});
Object.assign(elem, fn);
const $elem = FakeElement(selector, {...create_opts});
Object.assign($elem, fn);
// Create a proxy handler to detect missing stubs.
//
@@ -76,7 +76,7 @@ function make_zjquery() {
},
};
const proxy = new Proxy(elem, handler);
const proxy = new Proxy($elem, handler);
return proxy;
}
@@ -130,8 +130,8 @@ function make_zjquery() {
verify_selector_for_zulip(selector);
if (!elems.has(selector)) {
const elem = new_elem(selector);
elems.set(selector, elem);
const $elem = new_elem(selector);
elems.set(selector, $elem);
}
return elems.get(selector);
};
@@ -146,10 +146,10 @@ function make_zjquery() {
zjquery.create = function (name, opts) {
assert.ok(!elems.has(name), "You already created an object with this name!!");
const elem = new_elem(name, opts);
elems.set(name, elem);
const $elem = new_elem(name, opts);
elems.set(name, $elem);
return elem;
return $elem;
};
zjquery.trim = function (s) {
@@ -250,4 +250,4 @@ const $ = new Proxy(make_zjquery(), {
},
});
module.exports = $;
module.exports = $; // eslint-disable-line no-jquery/variable-pattern