mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	js: Prefix jQuery object variable names with $.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user