Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewhiteley committed Sep 23, 2022
2 parents a910cba + 16e82ca commit a3d2270
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/e.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ <h2>Event Bus</h2>
</div>


<a href="#sdsd" class="delegatedblurfocus">delegated blur focus</a>
<a href="#sdsd2" class="delegatedblurfocus">delegated blur focus</a>



<script src="test.min.js"></script>
5 changes: 3 additions & 2 deletions examples/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import E from '../instance'
import E from '../src/e'

const btn = document.getElementById('btn')
const btn2 = document.getElementById('btn2')
Expand All @@ -16,7 +16,6 @@ class Foo {
E.delegate('click','#btn3', this.onceHandler)
E.delegate('click','.deep', this.delegateHandler)


E.on('mouseenter', document.querySelectorAll('.nodelist'), () => console.log('nodelist'))
E.on('mouseenter', [...document.querySelectorAll('.nodelist')], () => console.log('nodelist array'))

Expand All @@ -25,6 +24,8 @@ class Foo {
//E.off('mouseenter', '#mouseover', this.delegatedMouseEnter)
//E.off('mouseleave', '#mouseover', this.delegatedMouseLeave)

E.delegate('blur focus', '.delegatedblurfocus', (e) => console.log(`delegated ${e.type}`))

E.delegate('click','button, h2', () => console.log('qs example'))

// Event bus example
Expand Down
4 changes: 2 additions & 2 deletions src/e.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ declare class E {
* Bind event to a string, NodeList, or element.
*
* @param {string} event
* @param {string|NodeList|HTMLElement|Element|Window|Document|array|function} el
* @param {string|NodeList|HTMLElement|HTMLElement[]|Window|Document|function} el
* @param {*} [callback]
* @param {{}|boolean} [options]
*/
on(event: string, el: string | NodeList | HTMLElement | Element | Window | Document | any[] | Function, callback?: any, options?: {} | boolean): void;
on(event: string, el: string | NodeList | HTMLElement | HTMLElement[] | Window | Document | Function, callback?: any, options?: {} | boolean): void;
/**
* Add a delegated event.
*
Expand Down
2 changes: 1 addition & 1 deletion src/e.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class E {
* Bind event to a string, NodeList, or element.
*
* @param {string} event
* @param {string|NodeList|HTMLElement|Element|Window|Document|array|function} el
* @param {string|NodeList|HTMLElement|HTMLElement[]|Window|Document|function} el
* @param {*} [callback]
* @param {{}|boolean} [options]
*/
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const listeners = {}
* Events that don't bubble
* @type {string[]}
*/
const nonBubblers = ['mouseenter', 'mouseleave', 'pointerenter', 'pointerleave']
const nonBubblers = ['mouseenter', 'mouseleave', 'pointerenter', 'pointerleave', 'blur', 'focus']

/**
* Make a bus stack if not already created.
Expand Down

0 comments on commit a3d2270

Please sign in to comment.