mol_jsx_lib 0.0.59 → 0.0.62
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.deps.json +1 -1
- package/node.esm.js +5 -3
- package/node.esm.js.map +1 -1
- package/node.js +5 -3
- package/node.js.map +1 -1
- package/node.test.js +9 -5
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
- package/web.esm.js +5 -3
- package/web.esm.js.map +1 -1
- package/web.js +5 -3
- package/web.js.map +1 -1
- package/web.test.js +4 -2
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -820,7 +820,7 @@ var $;
|
|
|
820
820
|
function $mol_jsx(Elem, props, ...childNodes) {
|
|
821
821
|
const id = props && props.id || '';
|
|
822
822
|
const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
|
|
823
|
-
const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(
|
|
823
|
+
const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
|
|
824
824
|
if (Elem && $.$mol_jsx_booked) {
|
|
825
825
|
if ($.$mol_jsx_booked.has(id)) {
|
|
826
826
|
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
|
|
@@ -896,7 +896,11 @@ var $;
|
|
|
896
896
|
$mol_dom_render_children(node, [].concat(...childNodes));
|
|
897
897
|
if (!Elem)
|
|
898
898
|
return node;
|
|
899
|
+
if (guid)
|
|
900
|
+
node.id = guid;
|
|
899
901
|
for (const key in props) {
|
|
902
|
+
if (key === 'id')
|
|
903
|
+
continue;
|
|
900
904
|
if (typeof props[key] === 'string') {
|
|
901
905
|
;
|
|
902
906
|
node.setAttribute(key, props[key]);
|
|
@@ -913,8 +917,6 @@ var $;
|
|
|
913
917
|
node[key] = props[key];
|
|
914
918
|
}
|
|
915
919
|
}
|
|
916
|
-
if (guid)
|
|
917
|
-
node.id = guid;
|
|
918
920
|
if ($.$mol_jsx_crumbs)
|
|
919
921
|
node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
|
|
920
922
|
return node;
|
|
@@ -2834,10 +2836,12 @@ var $;
|
|
|
2834
2836
|
$mol_jsx("img", { id: "icon" })));
|
|
2835
2837
|
};
|
|
2836
2838
|
const Bar = (props, icon) => {
|
|
2837
|
-
return $mol_jsx("span", null,
|
|
2839
|
+
return $mol_jsx("span", null,
|
|
2840
|
+
icon,
|
|
2841
|
+
$mol_jsx("i", { id: "label" }));
|
|
2838
2842
|
};
|
|
2839
2843
|
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
2840
|
-
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"></span></div>');
|
|
2844
|
+
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
2841
2845
|
},
|
|
2842
2846
|
'Fail on non unique ids'() {
|
|
2843
2847
|
const App = () => {
|