Skip to content Skip to sidebar Skip to footer

Javascript: Adding 'false' After Running A Function

I'm analyzing a plugin as I want to modify it. I see various events firing functions like this: document.getElementById(this.config.form).addEventListener('submit', this._sub

Solution 1:

It's useCapture variable.

If true, useCapture indicates that the user wishes to initiate capture. After initiating capture, all events of the specified type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree. Events which are bubbling upward through the tree will not trigger a listener designated to use capture. See DOM Level 3 Events for a detailed explanation. If not specified, useCapture defaults to false.

See MDN.


Solution 2:

Taken from : https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener

useCapture Optional If true, useCapture indicates that the user wishes to initiate capture. After initiating capture, all events of the specified type will be dispatched to the registered listener before being dispatched to any EventTarget beneath it in the DOM tree. Events which are bubbling upward through the tree will not trigger a listener designated to use capture. See DOM Level 3 Events for a detailed explanation. If not specified, useCapture defaults to false. Note: useCapture became optional only in more recent versions of the major browsers; for example, it was not optional prior to Firefox 6. You should provide this parameter for broadest compatibility.


Post a Comment for "Javascript: Adding 'false' After Running A Function"