Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/sixty-fans-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@marko/runtime-tags": patch
"@marko/translator-interop-class-tags": patch
---

Increase specificity of dynamic tag normalization
4 changes: 2 additions & 2 deletions .sizes.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
{
"name": "*",
"total": {
"min": 19308,
"brotli": 7346
"min": 19360,
"brotli": 7338
}
},
{
Expand Down
8 changes: 6 additions & 2 deletions .sizes/dom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// size: 19308 (min) 7346 (brotli)
// size: 19360 (min) 7338 (brotli)
var empty = [],
rest = Symbol();
function attrTag(attrs) {
Expand Down Expand Up @@ -69,7 +69,11 @@ function getEventHandlerName(name) {
return "-" === name[2] ? name.slice(3) : name.slice(2).toLowerCase();
}
function normalizeDynamicRenderer(value) {
return value ? value.content || value.default || value : void 0;
if (value) {
if ("string" == typeof value) return value;
let normalized = value.content || value.default || value;
if ("___id" in normalized) return normalized;
}
}
var defaultDelegator = createDelegator();
function _on(element, type, handler) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"vars": {
"props": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Render
```html
<div />
<div>
Hello
</div>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Render
```html
<div />
<div>
Hello
</div>
```

# Mutations
```
INSERT div0, div1
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const $template = "<div><!></div>";
export const $walks = /* next(1), replace, out(1) */"D%l";
export const $setup = () => {};
import * as _ from "@marko/runtime-tags/debug/dom";
const $dynamicTag = /* @__PURE__ */_._dynamic_tag("#text/0");
export const $input = /* @__PURE__ */_._const("input", $dynamicTag);
export default /* @__PURE__ */_._template("__tests__/tags/child.marko", $template, $walks, $setup, $input);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// size: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const $template = `${_child_template}${_child_template}`;
export const $walks = /* beginChild, _child_walks, endChild, beginChild, _child_walks, endChild */`/${_child_walks}&/${_child_walks}&`;
import { $setup as _child, $input as _child_input, $template as _child_template, $walks as _child_walks } from "./tags/child.marko";
import * as _ from "@marko/runtime-tags/debug/dom";
const $child_content = /* @__PURE__ */_._content("__tests__/template.marko_1_content", "Hello", /* over(1) */"b");
export function $setup($scope) {
_child($scope["#childScope/0"]);
_child_input($scope["#childScope/0"], {});
_child($scope["#childScope/1"]);
_child_input($scope["#childScope/1"], {
content: $child_content($scope)
});
}
export default /* @__PURE__ */_._template("__tests__/template.marko", $template, $walks, $setup);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as _ from "@marko/runtime-tags/debug/html";
export default _._template("__tests__/tags/child.marko", input => {
const $serialize = _._get_serialize_reason();
const $scope0_id = _._scope_id();
_._html("<div>");
_._dynamic_tag($scope0_id, "#text/0", input, {}, 0, 0, _._serialize_guard($serialize, /* input */0));
_._html("</div>");
_._serialize_guard($serialize, /* input */0) && _._scope($scope0_id, {}, "__tests__/tags/child.marko", 0);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import _child from "./tags/child.marko";
import * as _ from "@marko/runtime-tags/debug/html";
export default _._template("__tests__/template.marko", input => {
const $scope0_id = _._scope_id();
_child({});
_child({
content: _._content("__tests__/template.marko_1_content", () => {
const $scope1_id = _._scope_id();
_._html("Hello");
})
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Render
```html
<div />
<div>
Hello
</div>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Render
```html
<html>
<head />
<body>
<div />
<div>
Hello
</div>
</body>
</html>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Render End
```html
<div />
<div>
Hello
</div>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Write
```html
<div></div><div>Hello</div>
```

# Render End
```html
<html>
<head />
<body>
<div />
<div>
Hello
</div>
</body>
</html>
```

# Mutations
```
INSERT html
INSERT html/head
INSERT html/body
INSERT html/body/div0
INSERT html/body/div1
INSERT html/body/div1/#text
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
div
${input}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<child/>
<child>Hello</child>
8 changes: 7 additions & 1 deletion packages/runtime-tags/src/common/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,11 @@ export function alphaEncode(num: number): string {
export function normalizeDynamicRenderer<Renderer>(
value: any,
): Renderer | string | undefined {
return value ? value.content || value.default || value : undefined;
if (value) {
if (typeof value === "string") return value;
const normalized = value.content || value.default || value;
if ("___id" in normalized) {
return normalized;
}
}
}
Loading