diff --git a/src/taglibs/migrate/all-tags/w-id.js b/src/taglibs/migrate/all-tags/w-id.js index 4bb0570e3..49cd35e27 100644 --- a/src/taglibs/migrate/all-tags/w-id.js +++ b/src/taglibs/migrate/all-tags/w-id.js @@ -9,6 +9,9 @@ module.exports = function migrate(el, context) { ); el.setAttributeValue("key", attr.value); - if (!el.hasAttribute("id")) el.setAttributeValue("id:scoped", attr.value); + const isHTML = el.tagDef && el.tagDef.html; + const isDynamic = Boolean(el.rawTagNameExpression); + if (!el.hasAttribute("id") && (isHTML || isDynamic)) + el.setAttributeValue("id:scoped", attr.value); el.removeAttribute(attr.name); }; diff --git a/test/compiler/fixtures-html/invoke/expected.js b/test/compiler/fixtures-html/invoke/expected.js index 0af45f1cb..1eb706589 100644 --- a/test/compiler/fixtures-html/invoke/expected.js +++ b/test/compiler/fixtures-html/invoke/expected.js @@ -12,8 +12,7 @@ function render(input, out, __component, component, state) { var data = input; marko_dynamicTag(input, { - x: 1, - id: __component.elId("hi") + x: 1 }, out, __component, "hi"); } diff --git a/test/components-browser/fixtures-deprecated/widget-getWidget/components/app-foo/marko-tag.json b/test/components-browser/fixtures-deprecated/widget-getWidget/components/app-foo/marko-tag.json new file mode 100644 index 000000000..7b40a332a --- /dev/null +++ b/test/components-browser/fixtures-deprecated/widget-getWidget/components/app-foo/marko-tag.json @@ -0,0 +1,3 @@ +{ + "@foo": "string" +} diff --git a/test/migrate/fixtures/w-id/components/test.marko b/test/migrate/fixtures/w-id/components/test.marko new file mode 100644 index 000000000..e69de29bb diff --git a/test/migrate/fixtures/w-id/snapshot-expected.marko b/test/migrate/fixtures/w-id/snapshot-expected.marko index 0af1825e3..7c5e3c9a9 100644 --- a/test/migrate/fixtures/w-id/snapshot-expected.marko +++ b/test/migrate/fixtures/w-id/snapshot-expected.marko @@ -2,3 +2,5 @@
+