Assume I have the following simplified function.
var ex = document.getElementById('exampleElement'),
data = {
foo: 'Sample text'
};
ex.addEventListener('click', function(evt, d) {
evt.stopPropagation();
this.innerHTML = d.foo;
}.bind(ex, null, data));
I realise binding ex
to this
is somewhat redundant in this particular case, but how can I bind the data
parameter and still keep the event
argument from being destroyed?
I can't seem to find the answer anywhere.