@getforma/core 1.0.9 → 1.0.10

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/dist/runtime.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkT33QUD2Y_cjs = require('./chunk-T33QUD2Y.cjs');
4
+ var chunk263HW3KN_cjs = require('./chunk-263HW3KN.cjs');
4
5
  var chunk6FW5E54W_cjs = require('./chunk-6FW5E54W.cjs');
5
6
  var chunkQLPCVK7C_cjs = require('./chunk-QLPCVK7C.cjs');
6
7
 
@@ -335,6 +336,11 @@ function createReconciler(config) {
335
336
  }
336
337
 
337
338
  // src/runtime.ts
339
+ function isUnsafeAttrBinding(name, value) {
340
+ if (chunk263HW3KN_cjs.isEventHandlerAttr(name)) return true;
341
+ if (chunk263HW3KN_cjs.isUrlAttr(name) && chunk263HW3KN_cjs.isDangerousUrl(value)) return true;
342
+ return false;
343
+ }
338
344
  var _refetchRegistry = /* @__PURE__ */ new Map();
339
345
  function $refetch(id) {
340
346
  const fn = _refetchRegistry.get(id);
@@ -1337,7 +1343,12 @@ function cloneAttributeTemplates(el, item) {
1337
1343
  if (attr.value.includes("{item")) {
1338
1344
  const compiled = compileTemplate(attr.value);
1339
1345
  entries.push({ attr: attr.name, compiled });
1340
- node.setAttribute(attr.name, evaluateCompiledTemplate(compiled, item));
1346
+ const value = evaluateCompiledTemplate(compiled, item);
1347
+ if (isUnsafeAttrBinding(attr.name, value)) {
1348
+ node.removeAttribute(attr.name);
1349
+ } else {
1350
+ node.setAttribute(attr.name, value);
1351
+ }
1341
1352
  }
1342
1353
  }
1343
1354
  if (entries.length > 0) {
@@ -2179,7 +2190,12 @@ function bindElement(el, scope, disposers) {
2179
2190
  if (val == null || val === false) {
2180
2191
  el.removeAttribute(attrName);
2181
2192
  } else {
2182
- el.setAttribute(attrName, String(val));
2193
+ const str = String(val);
2194
+ if (isUnsafeAttrBinding(attrName, str)) {
2195
+ el.removeAttribute(attrName);
2196
+ } else {
2197
+ el.setAttribute(attrName, str);
2198
+ }
2183
2199
  }
2184
2200
  });
2185
2201
  disposers.push(dispose);