material 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "material",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "A lightweight implementation of Material Design Components for the web - ES6",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2,7 +2,7 @@ import extract from './extract'
2
2
  import last from './last'
3
3
 
4
4
  const events = {
5
- eventHandlers: {}, // Utiliser un tableau pour stocker les événements et les gestionnaires
5
+ eventHandlers: {}, // Use an array to store events and handlers
6
6
 
7
7
  attach (eventsArray, context) {
8
8
  if (!eventsArray) return
@@ -38,9 +38,15 @@ const events = {
38
38
  return // Cannot bind function for eventDef
39
39
  }
40
40
 
41
+ let isPassive = false
42
+ if (e.name === 'touchstart' || e.name === 'touchmove') {
43
+ isPassive = true
44
+ option = { ...option, passive: true }
45
+ }
46
+
41
47
  if (!this.eventHandlers[uid][eventDef]) {
42
48
  if (handler && e && e.element?.addEventListener) {
43
- e.element.addEventListener(e.name, handler, option)
49
+ e.element.addEventListener(e.name, handler, isPassive ? { passive: true } : option)
44
50
  this.eventHandlers[uid][eventDef] = handler
45
51
  } else if (e && e.element?.on && handler) {
46
52
  e.element.on(e.name, handler)