Gravatar for flussier@coveo.com

Question by flussier, Sep 26, 2016 12:37 PM

JSUI - DOM Trigger vs Jquery Trigger

As you can see with the code below, the trigger function doesn't work the same way when using JQuery. When I create custom component with Jquery installed, The code force Jquery to be use and can't send data because something overwrite it for the DOM format. Should not the Jquery Trigger be in this format : jq(this.el).trigger(type, { detail: data, bubbles: true }); ?

Dom.prototype.trigger = function (type, data) {
    var jq = this.getJQuery();
    if (jq) {
        jq(this.el).trigger(type, data);
    }
    else if (CustomEvent !== undefined) {
        var event = new CustomEvent(type, { detail: data, bubbles: true });
        this.el.dispatchEvent(event);
    }
    else {
        // TODO Support for older browser ?
        new Logger_1.Logger(this).error('CANNOT TRIGGER EVENT FOR OLDER BROWSER');
    }
};
0 Reply
Ask a question