Apply new format to snippets and template

This commit is contained in:
Angelos Chalaris
2020-09-15 16:28:04 +03:00
parent 040efd4380
commit 53c16dbf65
401 changed files with 969 additions and 950 deletions

View File

@ -5,10 +5,10 @@ tags: browser,event,intermediate
Adds an event listener to an element with the ability to use event delegation.
Use `EventTarget.addEventListener()` to add an event listener to an element.
If there is a `target` property supplied to the options object, ensure the event target matches the target specified and then invoke the callback by supplying the correct `this` context.
Returns a reference to the custom delegator function, in order to be possible to use with [`off`](#off).
Omit `opts` to default to non-delegation behavior and event bubbling.
- Use `EventTarget.addEventListener()` to add an event listener to an element.
- If there is a `target` property supplied to the options object, ensure the event target matches the target specified and then invoke the callback by supplying the correct `this` context.
- Returns a reference to the custom delegator function, in order to be possible to use with [`off`](#off).
- Omit `opts` to default to non-delegation behavior and event bubbling.
```js
const on = (el, evt, fn, opts = {}) => {