javascript - why is overriding window.onresize bad practise? -
refering javascript window resize event
they mentioned solution add listener window "resize" event , said overriding window.resize bad practise...
my question why?
the same applies events: using .onsomething = function() {...}
assignment, , overwrite existing event handler, can bugger other pieces of code.
addeventlistener
, on other hand, add new event handler without affecting existing ones.
one thing watch out i've seen numerous cases same event handler gets repeatedly added due bad code, whereas using .onsomething = ...
avoid problem.
Comments
Post a Comment