Reduce memory allocation/usage across multiple event handlers

- `handleEvent` is a very useful tool.
- Always use `addEventListener`/`removeEventListener`, since it's
  required for this optimization.
- Change log updated.
- Drive-by: make DOM mock work with both event listener types.
- Drive-by: eliminate possibility of `Object.prototype` interference.
This commit is contained in:
Isiah Meadows 2017-08-25 05:19:30 -04:00
parent 164fa5615b
commit dbbdb0664a
3 changed files with 30 additions and 17 deletions

View file

@ -28,6 +28,9 @@
- API: `m.route.set()` causes all mount points to be redrawn ([#1592](https://github.com/MithrilJS/mithril.js/pull/1592))
- API: If a user sets the Content-Type header within a request's options, that value will be the entire header value rather than being appended to the default value ([#1924](https://github.com/MithrilJS/mithril.js/pull/1924))
- API: Using style objects in hyperscript calls will now properly diff style properties from one render to another as opposed to re-writing all element style properties every render.
- core: `addEventListener` and `removeEventListener` are always used to manage event subscriptions, preventing external interference.
- core: Event listeners allocate less memory, swap at low cost, and are properly diffed now when rendered via `m.mount()`/`m.redraw()`.
- core: `Object.prototype` properties can no longer interfere with event listener calls.
---