@skirbi/sugar 0.1.15 → 0.1.16
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/Changes +7 -0
- package/lib/htmlelement-input.mjs +6 -2
- package/lib/index.mjs +1 -1
- package/package.json +1 -1
package/Changes
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
Revision history for @skirbi/sugar
|
|
2
2
|
|
|
3
|
+
0.1.16 2026-07-08 15:47:05Z
|
|
4
|
+
|
|
5
|
+
* Fix event handling in testsuites. Under jsdom, a bare `Event` reference
|
|
6
|
+
resolves to Node's own global Event class, not a jsdom window.Event.
|
|
7
|
+
Jsdom's dispatchEvent rejects an event instance that isn't its own realm's
|
|
8
|
+
Event, so window.Event must be preferred whenever it exists.
|
|
9
|
+
|
|
3
10
|
0.1.15 2026-07-03 22:08:57Z
|
|
4
11
|
|
|
5
12
|
* Add MouseEvent for @skirbi/semtic
|
|
@@ -185,6 +185,10 @@ export class HTMLElementSugarInput extends HTMLElementSugar {
|
|
|
185
185
|
setupFormControl(control) {
|
|
186
186
|
const valueAttr = this.constructor.valueAttr || 'value';
|
|
187
187
|
|
|
188
|
+
// Resolve Event from the current runtime (jsdom exposes it on window, not
|
|
189
|
+
// always on globalThis)
|
|
190
|
+
const EventCtor = globalThis.window?.Event || globalThis.Event;
|
|
191
|
+
|
|
188
192
|
const syncHostValue = () => {
|
|
189
193
|
if ('value' in control) {
|
|
190
194
|
this.setAttribute(valueAttr, control.value ?? '');
|
|
@@ -193,12 +197,12 @@ export class HTMLElementSugarInput extends HTMLElementSugar {
|
|
|
193
197
|
|
|
194
198
|
control.addEventListener('input', () => {
|
|
195
199
|
syncHostValue();
|
|
196
|
-
this.dispatchEvent(new
|
|
200
|
+
this.dispatchEvent(new EventCtor('input', { bubbles: true, composed: true }));
|
|
197
201
|
});
|
|
198
202
|
|
|
199
203
|
control.addEventListener('change', () => {
|
|
200
204
|
syncHostValue();
|
|
201
|
-
this.dispatchEvent(new
|
|
205
|
+
this.dispatchEvent(new EventCtor('change', { bubbles: true,
|
|
202
206
|
composed: true }));
|
|
203
207
|
});
|
|
204
208
|
}
|
package/lib/index.mjs
CHANGED
package/package.json
CHANGED