Skip to content

Commit 5c26b9b

Browse files
authored
fix: regression with unquoted attribute with trailing slash (#1561)
1 parent bc21820 commit 5c26b9b

File tree

29 files changed

+47
-28
lines changed

29 files changed

+47
-28
lines changed

packages/marko/src/runtime/components/beginComponent.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,18 @@ module.exports = function beginComponent(
6565

6666
if ((ownerIsRenderBoundary || ownerWillRerender) && key != null) {
6767
out.w(
68-
"<!" +
68+
"<!--" +
6969
runtimeId +
7070
"^" +
7171
componentId +
7272
" " +
7373
ownerComponentDef.id +
7474
" " +
7575
key +
76-
">"
76+
"-->"
7777
);
7878
} else {
79-
out.w("<!" + runtimeId + "#" + componentId + ">");
79+
out.w("<!--" + runtimeId + "#" + componentId + "-->");
8080
}
8181

8282
return componentDef;

packages/marko/src/runtime/components/endComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var getComponentsContext = ComponentsContext.___getComponentsContext;
55

66
module.exports = function endComponent(out, componentDef) {
77
if (componentDef.___renderBoundary) {
8-
out.w("<!" + out.global.runtimeId + "/>");
8+
out.w("<!--" + out.global.runtimeId + "/-->");
99
getComponentsContext(out).___isPreserved = componentDef.___parentPreserved;
1010
}
1111
};

packages/marko/src/runtime/html/AsyncStream.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ var proto = (AsyncStream.prototype = {
573573

574574
___beginFragment: function(key, component, preserve) {
575575
if (preserve) {
576-
this.write("<!F#" + escapeXmlString(key) + ">");
576+
this.write("<!--F#" + escapeXmlString(key) + "-->");
577577
}
578578
if (this._elStack) {
579579
this._elStack.push(preserve);
@@ -585,7 +585,7 @@ var proto = (AsyncStream.prototype = {
585585
___endFragment: function() {
586586
var preserve = this._elStack.pop();
587587
if (preserve) {
588-
this.write("<!F/>");
588+
this.write("<!--F/-->");
589589
}
590590
},
591591

packages/marko/src/runtime/html/helpers/attr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ function guessQuotes(value) {
7575
}
7676
}
7777

78-
return value && "=" + value;
78+
return value && "=" + (value[len - 1] === "/" ? value + " " : value);
7979
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!M#s0><div class=a>Hello Frank</div><!M/>
1+
<!--M#s0--><div class=a>Hello Frank</div><!--M/-->
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!M#s0><div class=a>Hello Frank</div><!M/>
1+
<!--M#s0--><div class=a>Hello Frank</div><!--M/-->
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!M#s0><div class=b>Hello Frank</div><!M/>
1+
<!--M#s0--><div class=b>Hello Frank</div><!--M/-->
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!M#s0><div class=b>Hello Jane</div><!M/>
1+
<!--M#s0--><div class=b>Hello Jane</div><!--M/-->
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<html><body><!--FLUSH--><div class=inner><div class=inner-inner><!M#s0-7><div>Hello inner-inner</div><!M/></div><!M#s0-8><div>Hello inner</div><!M/></div><!M#s0-9><div>Hello outer</div><!M/><script>$MC=(window.$MC||[]).concat({"l":1,"w":[["s0-8",0,{"name":"inner"},{"f":1}],["s0-7",0,{"name":"inner-inner"},{"f":1}],["s0-9",0,{"name":"outer"},{"f":1}]],"t":["/marko-test$1.0.0/render/fixtures-async-deprecated/components-await-beginAsync/components/hello/index.marko"]})</script></body></html>
1+
<html><body><!--FLUSH--><div class=inner><div class=inner-inner><!--M#s0-7--><div>Hello inner-inner</div><!--M/--></div><!--M#s0-8--><div>Hello inner</div><!--M/--></div><!--M#s0-9--><div>Hello outer</div><!--M/--><script>$MC=(window.$MC||[]).concat({"l":1,"w":[["s0-8",0,{"name":"inner"},{"f":1}],["s0-7",0,{"name":"inner-inner"},{"f":1}],["s0-9",0,{"name":"outer"},{"f":1}]],"t":["/marko-test$1.0.0/render/fixtures-async-deprecated/components-await-beginAsync/components/hello/index.marko"]})</script></body></html>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<html><head><title><!--FLUSH-->Welcome Frank</title></head><body><!M#s0-0-5-5><div>Hello</div><!M/><script>$MC=(window.$MC||[]).concat({"l":1,"w":[["s0-0-5-5",0,{},{"f":1}]],"t":["/marko-test$1.0.0/render/fixtures-async-deprecated/components-await-title/components/hello/index.marko"]})</script></body></html>
1+
<html><head><title><!--FLUSH-->Welcome Frank</title></head><body><!--M#s0-0-5-5--><div>Hello</div><!--M/--><script>$MC=(window.$MC||[]).concat({"l":1,"w":[["s0-0-5-5",0,{},{"f":1}]],"t":["/marko-test$1.0.0/render/fixtures-async-deprecated/components-await-title/components/hello/index.marko"]})</script></body></html>

0 commit comments

Comments
 (0)