since the with() function is deprecated, I want to get rid of it in my code.
How can I do it in this particular function?
Original Code:
(function(a,b){
for(a in b=a.prototype)with({d:b[a]})b[a]=function(c){d.apply(this,arguments);return this}
})(Element);
Formatted code for reference:
(function(a, b) {
for (a in b = a.prototype)
with({ d: b[a] })
b[a] = function(c) {
d.apply(this, arguments);
return this
}
})(Element);
The reason
withis being used is to close over the value ofb[a]within the function, the correct replacement is with a closure: