mol_regexp 0.0.409 → 0.0.412

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
@@ -745,7 +745,7 @@ var $;
745
745
  return $mol_jsx("button", { title: props.hint }, target());
746
746
  };
747
747
  const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
748
- $mol_assert_equal(dom.outerHTML, '<button title="click me" id="foo" class="Button">hey!</button>');
748
+ $mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
749
749
  },
750
750
  'Nested guid generation'() {
751
751
  const Foo = () => {
@@ -810,7 +810,7 @@ var $;
810
810
  function $mol_jsx(Elem, props, ...childNodes) {
811
811
  const id = props && props.id || '';
812
812
  const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
813
- const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id}`) : $.$mol_jsx_crumbs;
813
+ const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
814
814
  if (Elem && $.$mol_jsx_booked) {
815
815
  if ($.$mol_jsx_booked.has(id)) {
816
816
  $mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
@@ -886,7 +886,11 @@ var $;
886
886
  $mol_dom_render_children(node, [].concat(...childNodes));
887
887
  if (!Elem)
888
888
  return node;
889
+ if (guid)
890
+ node.id = guid;
889
891
  for (const key in props) {
892
+ if (key === 'id')
893
+ continue;
890
894
  if (typeof props[key] === 'string') {
891
895
  ;
892
896
  node.setAttribute(key, props[key]);
@@ -903,8 +907,6 @@ var $;
903
907
  node[key] = props[key];
904
908
  }
905
909
  }
906
- if (guid)
907
- node.id = guid;
908
910
  if ($.$mol_jsx_crumbs)
909
911
  node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
910
912
  return node;