Skip to content

Commit

Permalink
Remove empty layout-put tags
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Jun 14, 2019
1 parent a5778de commit 1a319c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/core-tags/migrate/layout-put-tag.js
Expand Up @@ -29,5 +29,11 @@ module.exports = function migrator(oldNode, context) {
}

oldNode.moveChildrenTo(newNode);
oldNode.replaceWith(newNode);
newNode._normalizeChildTextNodes(context, true, true);

if (newNode.childCount) {
oldNode.replaceWith(newNode);
} else {
oldNode.detach();
}
};
9 changes: 8 additions & 1 deletion test/migrate/fixtures/layout-put/template.marko
@@ -1,2 +1,9 @@
<layout-put into="body">BODY CONTENT</layout-put>
<layout-put into="footer" value="FOOTER CONTENT"></layout-put>
<layout-put into="footer" value="FOOTER CONTENT"></layout-put>

<layout-put into="example-empty1" value=""/>
<layout-put into="example-empty2"></layout-put>
<layout-put into="example-empty3">

</layout-put>
<layout-put into="example-empty4"/>

0 comments on commit 1a319c3

Please sign in to comment.