I'm creating a slider widget to let me manage ranges of values, and have most of it complete.
Here is a demo of it: https://jsfiddle.net/d1wqb63a/
I want to set it up to actually trigger an onmouseup event when the mouse is released, with additional data in it. That is working, except that it is now triggers the onmouseup twice. Once directly by the browser and once by my code.
You can see that in the jsfiddle demo above. The output to the console is "undefined" when called by the normal event, and some actual data when called by mine, as it's trying to access the custom info I added.
Here's what I'm doing to trigger the event:
var e = new Event('mouseup');
e.sliderValues = JSON.parse(JSON.stringify(config.values));
element.dispatchEvent(e);
What I don't know is how to disable the already triggered event; i.e, stop the browser from triggering the actual onmouseup event despite my adding the onmouseup callback. Is that even doable?