@cocreate/events 1.19.2 → 1.19.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.19.3](https://github.com/CoCreate-app/CoCreate-events/compare/v1.19.2...v1.19.3) (2024-02-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * handle values that are not string ([7b1374b](https://github.com/CoCreate-app/CoCreate-events/commit/7b1374b984673f541b99d7deb29af990b88e962c))
7
+
1
8
  ## [1.19.2](https://github.com/CoCreate-app/CoCreate-events/compare/v1.19.1...v1.19.2) (2024-02-18)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/events",
3
- "version": "1.19.2",
3
+ "version": "1.19.3",
4
4
  "description": "A simple events component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "events",
package/src/index.js CHANGED
@@ -244,9 +244,13 @@ const CoCreateEvents = {
244
244
  } else {
245
245
  values = element.getAttribute(`${prefix}-value`) || element.getAttribute(`${prefix}-if-value`) || element.getAttribute(prefix);
246
246
  }
247
- if (values)
248
- values = values.split(',');
249
- else {
247
+
248
+ if (values) {
249
+ if (typeof values === 'string')
250
+ values = values.split(',');
251
+ else if (!Array.isArray(values))
252
+ values = [values]
253
+ } else {
250
254
  values = await element.getValue()
251
255
  if (!Array.isArray(values))
252
256
  values = [values]
@@ -313,7 +317,8 @@ const CoCreateEvents = {
313
317
  // values = values.map(x => x.trim());
314
318
 
315
319
  values = values.map(x => {
316
- x = x.trim(); // Update x with the trimmed value
320
+ if (typeof x === 'string')
321
+ x = x.trim(); // Update x with the trimmed value
317
322
  let prop = element.getAttribute(`${prefix}-property`);
318
323
  if (prop) {
319
324
  x = `${prop}:${x}`; // Update x with prop if it exists