mol_db 0.0.310 → 0.0.313

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/node.test.js CHANGED
@@ -1177,7 +1177,7 @@ var $;
1177
1177
  return $mol_jsx("button", { title: props.hint }, target());
1178
1178
  };
1179
1179
  const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
1180
- $mol_assert_equal(dom.outerHTML, '<button title="click me" id="foo" class="Button">hey!</button>');
1180
+ $mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
1181
1181
  },
1182
1182
  'Nested guid generation'() {
1183
1183
  const Foo = () => {
@@ -1242,7 +1242,7 @@ var $;
1242
1242
  function $mol_jsx(Elem, props, ...childNodes) {
1243
1243
  const id = props && props.id || '';
1244
1244
  const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
1245
- const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id}`) : $.$mol_jsx_crumbs;
1245
+ const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
1246
1246
  if (Elem && $.$mol_jsx_booked) {
1247
1247
  if ($.$mol_jsx_booked.has(id)) {
1248
1248
  $mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
@@ -1318,7 +1318,11 @@ var $;
1318
1318
  $mol_dom_render_children(node, [].concat(...childNodes));
1319
1319
  if (!Elem)
1320
1320
  return node;
1321
+ if (guid)
1322
+ node.id = guid;
1321
1323
  for (const key in props) {
1324
+ if (key === 'id')
1325
+ continue;
1322
1326
  if (typeof props[key] === 'string') {
1323
1327
  ;
1324
1328
  node.setAttribute(key, props[key]);
@@ -1335,8 +1339,6 @@ var $;
1335
1339
  node[key] = props[key];
1336
1340
  }
1337
1341
  }
1338
- if (guid)
1339
- node.id = guid;
1340
1342
  if ($.$mol_jsx_crumbs)
1341
1343
  node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
1342
1344
  return node;