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._submit, false);
My question is - what does false on the end actually do? Is it the same as adding return = false on the end of a function? If so, what is the purpose of adding this?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With