mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
fix: regression with unquoted attribute with trailing slash (#1561)
(cherry picked from commit 5c26b9b3ec6f5e8847ffe43e99f7593da806932a)
This commit is contained in:
parent
dd9f7aca84
commit
128b68aefc
@ -54,7 +54,7 @@ module.exports = function beginComponent(
|
||||
|
||||
if ((ownerIsRenderBoundary || ownerWillRerender) && key != null) {
|
||||
out.w(
|
||||
"<!" +
|
||||
"<!--" +
|
||||
runtimeId +
|
||||
"^" +
|
||||
componentId +
|
||||
@ -62,10 +62,10 @@ module.exports = function beginComponent(
|
||||
ownerComponentDef.id +
|
||||
" " +
|
||||
key +
|
||||
">"
|
||||
"-->"
|
||||
);
|
||||
} else {
|
||||
out.w("<!" + runtimeId + "#" + componentId + ">");
|
||||
out.w("<!--" + runtimeId + "#" + componentId + "-->");
|
||||
}
|
||||
|
||||
return componentDef;
|
||||
|
||||
@ -5,7 +5,7 @@ var getComponentsContext = ComponentsContext.___getComponentsContext;
|
||||
|
||||
module.exports = function endComponent(out, componentDef) {
|
||||
if (componentDef.___renderBoundary) {
|
||||
out.w("<!" + out.global.runtimeId + "/>");
|
||||
out.w("<!--" + out.global.runtimeId + "/-->");
|
||||
getComponentsContext(out).___isPreserved = componentDef.___parentPreserved;
|
||||
}
|
||||
};
|
||||
|
||||
@ -571,7 +571,7 @@ var proto = (AsyncStream.prototype = {
|
||||
|
||||
___beginFragment: function(key, component, preserve) {
|
||||
if (preserve) {
|
||||
this.write("<!F#" + escapeXmlString(key) + ">");
|
||||
this.write("<!--F#" + escapeXmlString(key) + "-->");
|
||||
}
|
||||
if (this._elStack) {
|
||||
this._elStack.push(preserve);
|
||||
@ -583,7 +583,7 @@ var proto = (AsyncStream.prototype = {
|
||||
___endFragment: function() {
|
||||
var preserve = this._elStack.pop();
|
||||
if (preserve) {
|
||||
this.write("<!F/>");
|
||||
this.write("<!--F/-->");
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -62,5 +62,5 @@ function guessQuotes(value) {
|
||||
}
|
||||
}
|
||||
|
||||
return value && "=" + value;
|
||||
return value && "=" + (value[len - 1] === "/" ? value + " " : value);
|
||||
}
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
<div a=abc b="abc " c="abc'" d='abc"' e="abc'"" f='abc"'' g="abc " h="abc
|
||||
" i="abc
" j="abc" l=/abc k=abc/ ></div>
|
||||
@ -0,0 +1,14 @@
|
||||
<div
|
||||
a="abc"
|
||||
b="abc "
|
||||
c="abc'"
|
||||
d='abc"'
|
||||
e="abc'\""
|
||||
f="abc\"'"
|
||||
g="abc\t"
|
||||
h="abc\n"
|
||||
i="abc\r"
|
||||
j="abc\f"
|
||||
l="/abc"
|
||||
k="abc/"
|
||||
/>
|
||||
@ -0,0 +1 @@
|
||||
exports.templateData = {};
|
||||
@ -0,0 +1,2 @@
|
||||
<DIV a="abc" b="abc " c="abc'" d="abc"" e="abc'"" f="abc"'" g="abc " h="abc
|
||||
" i="abc
" j="abc" k="abc/" l="/abc">
|
||||
@ -1 +1 @@
|
||||
<!M#s0><div id="s0-buttonDescription">Submit the form thing</div><button aria-described-by="s0-buttonDescription">Submit</button><!M/>
|
||||
<!--M#s0--><div id=s0-buttonDescription>Submit the form thing</div><button aria-described-by=s0-buttonDescription>Submit</button><!--M/-->
|
||||
@ -1 +1 @@
|
||||
<div><!M#s0-1><div class=hello>Hello Frank!</div><!M/></div>
|
||||
<div><!--M#s0-1--><div class=hello>Hello Frank!</div><!--M/--></div>
|
||||
@ -1 +1 @@
|
||||
<!M#s0><label for="s0-submitButton">Submit</label><button id="s0-submitButton">Submit</button><!M/>
|
||||
<!--M#s0--><label for=s0-submitButton>Submit</label><button id=s0-submitButton>Submit</button><!--M/-->
|
||||
@ -1 +1 @@
|
||||
<!M#s0><!DOCTYPE html><html lang=en><body>Hello<script>$MC=(window.$MC||[]).concat({"l":1,"w":[["s0",0,{"foo-0":"bar\u2028","foo-1":"bar\u2029","foo-2":"\u2028bar\u2029","foo-3":"Hello \u003C/script> \u2028bar\u2029"},{"f":1}]],"t":["5hvxGDmQ"]})</script></body></html><!M/>
|
||||
<!--M#s0--><!DOCTYPE html><html lang=en><body>Hello<script>$MC=(window.$MC||[]).concat({"l":1,"w":[["s0",0,{"foo-0":"bar\u2028","foo-1":"bar\u2029","foo-2":"\u2028bar\u2029","foo-3":"Hello \u003C/script> \u2028bar\u2029"},{"f":1}]],"t":["5hvxGDmQ"]})</script></body></html><!--M/-->
|
||||
@ -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":["3fH9fWWr"]})</script></body></html>
|
||||
<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":["3fH9fWWr"]})</script></body></html>
|
||||
@ -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":["2tNfdcYI"]})</script></body></html>
|
||||
<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":["2tNfdcYI"]})</script></body></html>
|
||||
@ -1 +1 @@
|
||||
<html><body><!--FLUSH--><div class=inner><!--FLUSH--><div class=inner-inner><!M#s0-8><div>Hello inner-inner</div><!M/></div><!M#s0-9><div>Hello inner</div><!M/></div><!M#s0-10><div>Hello outer</div><!M/><script>$MC=(window.$MC||[]).concat({"l":1,"w":[["s0-8",0,{"name":"inner-inner"},{"f":1}],["s0-9",0,{"name":"inner"},{"f":1}],["s0-10",0,{"name":"outer"},{"f":1}]],"t":["2u6T2uUb"]})</script></body></html>
|
||||
<html><body><!--FLUSH--><div class=inner><!--FLUSH--><div class=inner-inner><!--M#s0-8--><div>Hello inner-inner</div><!--M/--></div><!--M#s0-9--><div>Hello inner</div><!--M/--></div><!--M#s0-10--><div>Hello outer</div><!--M/--><script>$MC=(window.$MC||[]).concat({"l":1,"w":[["s0-8",0,{"name":"inner-inner"},{"f":1}],["s0-9",0,{"name":"inner"},{"f":1}],["s0-10",0,{"name":"outer"},{"f":1}]],"t":["2u6T2uUb"]})</script></body></html>
|
||||
@ -1 +1 @@
|
||||
<html><head>Components</head><body><!M#s0-3><div><h1>foo1</h1><div><h1>bar1</h1></div><div><h1>bar2</h1></div><div><h1>foo-split1</h1><div><h1>split-child1</h1></div><div><h1>split-child2</h1></div></div><div><h1>foo-split2</h1><div><h1>split-child1</h1></div><div><h1>split-child2</h1></div></div></div><!M/><!M#s0-4><div><h1>foo2</h1><div><h1>bar1</h1></div><div><h1>bar2</h1></div><div><h1>foo-split1</h1><div><h1>split-child1</h1></div><div><h1>split-child2</h1></div></div><div><h1>foo-split2</h1><div><h1>split-child1</h1></div><div><h1>split-child2</h1></div></div></div><!M/><!M#s0-5><div><h1>split1</h1><!M^s0-5-@split-child1 s0-5 @split-child1><div><h1>split-child1</h1></div><!M/><!M^s0-5-@split-child2 s0-5 @split-child2><div><h1>split-child2</h1></div><!M/></div><!M/><!M#s0-6><div><h1>split2</h1><!M^s0-6-@split-child1 s0-6 @split-child1><div><h1>split-child1</h1></div><!M/><!M^s0-6-@split-child2 s0-6 @split-child2><div><h1>split-child2</h1></div><!M/></div><!M/><script>$MC=(window.$MC||[]).concat({"l":1,"w":[["s0-3",0,{"name":"foo1"},{"f":1}],["s0-4",0,{"name":"foo2"},{"f":1}],["s0-5",1,{"name":"split1"}],["s0-5-@split-child1",2,{"name":"split-child1"}],["s0-5-@split-child2",2,{"name":"split-child2"}],["s0-6",1,{"name":"split2"}],["s0-6-@split-child1",2,{"name":"split-child1"}],["s0-6-@split-child2",2,{"name":"split-child2"}]],"t":["EMljIY5B","30jLCJ__","IdzCtSbr"]})</script></body></html>
|
||||
<html><head>Components</head><body><!--M#s0-3--><div><h1>foo1</h1><div><h1>bar1</h1></div><div><h1>bar2</h1></div><div><h1>foo-split1</h1><div><h1>split-child1</h1></div><div><h1>split-child2</h1></div></div><div><h1>foo-split2</h1><div><h1>split-child1</h1></div><div><h1>split-child2</h1></div></div></div><!--M/--><!--M#s0-4--><div><h1>foo2</h1><div><h1>bar1</h1></div><div><h1>bar2</h1></div><div><h1>foo-split1</h1><div><h1>split-child1</h1></div><div><h1>split-child2</h1></div></div><div><h1>foo-split2</h1><div><h1>split-child1</h1></div><div><h1>split-child2</h1></div></div></div><!--M/--><!--M#s0-5--><div><h1>split1</h1><!--M^s0-5-@split-child1 s0-5 @split-child1--><div><h1>split-child1</h1></div><!--M/--><!--M^s0-5-@split-child2 s0-5 @split-child2--><div><h1>split-child2</h1></div><!--M/--></div><!--M/--><!--M#s0-6--><div><h1>split2</h1><!--M^s0-6-@split-child1 s0-6 @split-child1--><div><h1>split-child1</h1></div><!--M/--><!--M^s0-6-@split-child2 s0-6 @split-child2--><div><h1>split-child2</h1></div><!--M/--></div><!--M/--><script>$MC=(window.$MC||[]).concat({"l":1,"w":[["s0-3",0,{"name":"foo1"},{"f":1}],["s0-4",0,{"name":"foo2"},{"f":1}],["s0-5",1,{"name":"split1"}],["s0-5-@split-child1",2,{"name":"split-child1"}],["s0-5-@split-child2",2,{"name":"split-child2"}],["s0-6",1,{"name":"split2"}],["s0-6-@split-child1",2,{"name":"split-child1"}],["s0-6-@split-child2",2,{"name":"split-child2"}]],"t":["EMljIY5B","30jLCJ__","IdzCtSbr"]})</script></body></html>
|
||||
@ -1 +1 @@
|
||||
<!M#s0-0><div data-marko-key="@test s0-0">Body data</div><!M/><!M#s0-1><div>Body data</div><!M/><!M#s0-2><div data-marko-key="@test s0-2"></div><!M/><!M#s0-3><div></div><!M/>
|
||||
<!--M#s0-0--><div data-marko-key="@test s0-0">Body data</div><!--M/--><!--M#s0-1--><div>Body data</div><!--M/--><!--M#s0-2--><div data-marko-key="@test s0-2"></div><!--M/--><!--M#s0-3--><div></div><!--M/-->
|
||||
@ -1 +1 @@
|
||||
<!M#s0><!F#0>testPage http://ebay.com<div style="color:green"></div><!F/><!M/>
|
||||
<!--M#s0--><!--F#0-->testPage http://ebay.com<div style=color:green></div><!--F/--><!--M/-->
|
||||
@ -1 +1 @@
|
||||
<!FOO#s0><div></div><!FOO/>
|
||||
<!--FOO#s0--><div></div><!--FOO/-->
|
||||
Loading…
x
Reference in New Issue
Block a user