typed-dom
Advanced tools
Comparing version 0.0.268 to 0.0.269
14
dom.ts
@@ -134,4 +134,5 @@ import { Symbol, document } from 'spica/global'; | ||
for (const name of names) { | ||
if (name.slice(0, 2) !== 'on') throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${name}".`); | ||
el.addEventListener(name.slice(2), value, { | ||
if (!name.startsWith('on')) throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${name}".`); | ||
const eventname = name.slice(2).toLowerCase(); | ||
el.addEventListener(eventname, value, { | ||
passive: [ | ||
@@ -144,5 +145,10 @@ 'wheel', | ||
'touchcancel', | ||
].includes(name.slice(2)), | ||
].includes(eventname), | ||
}); | ||
el[name.toLowerCase()] ??= ''; | ||
switch (eventname) { | ||
case 'mutate': | ||
case 'connect': | ||
case 'disconnect': | ||
el[`on${eventname}`] ??= ''; | ||
} | ||
} | ||
@@ -149,0 +155,0 @@ continue; |
{ | ||
"name": "typed-dom", | ||
"version": "0.0.268", | ||
"version": "0.0.269", | ||
"description": "A value-level and type-level DOM builder.", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -78,5 +78,6 @@ import { Event } from 'spica/global'; | ||
const events = this[privates.events]; | ||
events.mutate = element['onmutate'] != null; | ||
events.connect = element['onconnect'] != null; | ||
events.disconnect = element['ondisconnect'] != null; | ||
assert('' != null); | ||
events.mutate = 'onmutate' in element && element['onmutate'] != null; | ||
events.connect = 'onconnect' in element && element['onconnect'] != null; | ||
events.disconnect = 'ondisconnect' in element && element['ondisconnect'] != null; | ||
this[privates.children] = children; | ||
@@ -83,0 +84,0 @@ this[privates.container] = container; |
@@ -134,4 +134,5 @@ import { Symbol, document } from 'spica/global'; | ||
for (const name of names) { | ||
if (name.slice(0, 2) !== 'on') throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${name}".`); | ||
el.addEventListener(name.slice(2), value, { | ||
if (!name.startsWith('on')) throw new Error(`TypedDOM: Attribute names for event listeners must start with "on" but got "${name}".`); | ||
const eventname = name.slice(2).toLowerCase(); | ||
el.addEventListener(eventname, value, { | ||
passive: [ | ||
@@ -144,5 +145,10 @@ 'wheel', | ||
'touchcancel', | ||
].includes(name.slice(2)), | ||
].includes(eventname), | ||
}); | ||
el[name.toLowerCase()] ??= ''; | ||
switch (eventname) { | ||
case 'mutate': | ||
case 'connect': | ||
case 'disconnect': | ||
el[`on${eventname}`] ??= ''; | ||
} | ||
} | ||
@@ -149,0 +155,0 @@ continue; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
674185
15864