mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Prevent mem-leak in buttons
Event handler should not have a reference to the DOM node in its context
This commit is contained in:
parent
6f263dd3fc
commit
191381f7da
@ -13,7 +13,7 @@ def create_button(text, icon=None, action=None, tooltip=None):
|
||||
text = '\xa0' + text
|
||||
ans = E.button(E.i(class_=cls), text, class_='calibre-push-button', type='button', title=tooltip or '')
|
||||
if action is not None:
|
||||
ans.addEventListener('click', def(event): event.preventDefault(), action(event, ans);)
|
||||
ans.addEventListener('click', def(event): event.preventDefault(), action(event);)
|
||||
return ans
|
||||
|
||||
create_button.style = build_rule('button.calibre-push-button',
|
||||
|
Loading…
x
Reference in New Issue
Block a user