diff --git a/packages/translator-default/src/tag/native-tag[html]/index.js b/packages/translator-default/src/tag/native-tag[html]/index.js index 574bbadb4..bb0276571 100644 --- a/packages/translator-default/src/tag/native-tag[html]/index.js +++ b/packages/translator-default/src/tag/native-tag[html]/index.js @@ -150,7 +150,11 @@ export default function (path, isNullable) { t.expressionStatement( t.callExpression( t.memberExpression(t.identifier("out"), t.identifier("bf")), - [normalizeTemplateString`f_${key}`, t.identifier("component")] + [ + normalizeTemplateString`f_${key}`, + t.identifier("component"), + t.numericLiteral(1) + ] ) ) ); diff --git a/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/cjs-expected.js b/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/cjs-expected.js index 9507bd68d..e90aa711f 100644 --- a/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/cjs-expected.js +++ b/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/cjs-expected.js @@ -37,11 +37,11 @@ _marko_template._ = (0, _renderer.default)(function (input, out, _component, com const _tagName = input.show ? "div" : null; - if (_tagName) out.w(`<${_tagName} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_2", component); + if (_tagName) out.w(`<${_tagName} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_2", component, 1); const _tagName2 = input.show && "div"; - if (_tagName2) out.w(`<${_tagName2} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_3", component); + if (_tagName2) out.w(`<${_tagName2} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_3", component, 1); const _tagName3 = input.large ? "h1" : "h2"; @@ -82,7 +82,7 @@ _marko_template._ = (0, _renderer.default)(function (input, out, _component, com const _tagName7 = largeHeading || "h2"; - if (_tagName7) out.w(`<${_tagName7} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_9", component); + if (_tagName7) out.w(`<${_tagName7} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_9", component, 1); const _tagName8 = global.x = "a" + "b"; @@ -96,12 +96,12 @@ _marko_template._ = (0, _renderer.default)(function (input, out, _component, com const tagConstA = "a"; out.w(`<${tagConstA} class="a b"${(0, _attr.default)("other", input.other)}>`); const tagConstB = input.show ? "div" : null; - if (tagConstB) out.w(`<${tagConstB} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_14", component); + if (tagConstB) out.w(`<${tagConstB} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_14", component, 1); let tagLazyAssign; tagLazyAssign = "a"; - if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_15", component); + if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_15", component, 1); tagLazyAssign = input.show ? "div" : null; - if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_16", component); + if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${(0, _attr.default)("other", input.other)}>`);else out.bf("f_16", component, 1); }, { t: _marko_componentType, i: true, diff --git a/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/html-expected.js b/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/html-expected.js index 5504f5c5d..b4050d8f5 100644 --- a/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/html-expected.js +++ b/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/html-expected.js @@ -23,11 +23,11 @@ _marko_template._ = _marko_renderer(function (input, out, _component, component, const _tagName = input.show ? "div" : null; - if (_tagName) out.w(`<${_tagName} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_2", component); + if (_tagName) out.w(`<${_tagName} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_2", component, 1); const _tagName2 = input.show && "div"; - if (_tagName2) out.w(`<${_tagName2} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_3", component); + if (_tagName2) out.w(`<${_tagName2} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_3", component, 1); const _tagName3 = input.large ? "h1" : "h2"; @@ -70,7 +70,7 @@ _marko_template._ = _marko_renderer(function (input, out, _component, component, const _tagName7 = largeHeading || "h2"; - if (_tagName7) out.w(`<${_tagName7} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_9", component); + if (_tagName7) out.w(`<${_tagName7} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_9", component, 1); const _tagName8 = global.x = "a" + "b"; @@ -84,12 +84,12 @@ _marko_template._ = _marko_renderer(function (input, out, _component, component, const tagConstA = "a"; out.w(`<${tagConstA} class="a b"${_marko_attr("other", input.other)}>`); const tagConstB = input.show ? "div" : null; - if (tagConstB) out.w(`<${tagConstB} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_14", component); + if (tagConstB) out.w(`<${tagConstB} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_14", component, 1); let tagLazyAssign; tagLazyAssign = "a"; - if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_15", component); + if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_15", component, 1); tagLazyAssign = input.show ? "div" : null; - if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_16", component); + if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_16", component, 1); }, { t: _marko_componentType, i: true, diff --git a/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/htmlProduction-expected.js b/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/htmlProduction-expected.js index fe3e9d019..5e8843e6b 100644 --- a/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/htmlProduction-expected.js +++ b/packages/translator-default/test/fixtures/dynamic-tag-name/snapshots/htmlProduction-expected.js @@ -23,11 +23,11 @@ _marko_template._ = _marko_renderer(function (input, out, _component, component, const _tagName = input.show ? "div" : null; - if (_tagName) out.w(`<${_tagName} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_2", component); + if (_tagName) out.w(`<${_tagName} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_2", component, 1); const _tagName2 = input.show && "div"; - if (_tagName2) out.w(`<${_tagName2} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_3", component); + if (_tagName2) out.w(`<${_tagName2} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_3", component, 1); const _tagName3 = input.large ? "h1" : "h2"; @@ -70,7 +70,7 @@ _marko_template._ = _marko_renderer(function (input, out, _component, component, const _tagName7 = largeHeading || "h2"; - if (_tagName7) out.w(`<${_tagName7} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_9", component); + if (_tagName7) out.w(`<${_tagName7} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_9", component, 1); const _tagName8 = global.x = "a" + "b"; @@ -84,12 +84,12 @@ _marko_template._ = _marko_renderer(function (input, out, _component, component, const tagConstA = "a"; out.w(`<${tagConstA} class="a b"${_marko_attr("other", input.other)}>`); const tagConstB = input.show ? "div" : null; - if (tagConstB) out.w(`<${tagConstB} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_14", component); + if (tagConstB) out.w(`<${tagConstB} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_14", component, 1); let tagLazyAssign; tagLazyAssign = "a"; - if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_15", component); + if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_15", component, 1); tagLazyAssign = input.show ? "div" : null; - if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_16", component); + if (tagLazyAssign) out.w(`<${tagLazyAssign} class="a b"${_marko_attr("other", input.other)}>`);else out.bf("f_16", component, 1); }, { t: _marko_componentType, i: true