=4.21.0
From version 4.21.0 til latest 4.23.2, quotes on attributes have changed behavior. Before 4.21.0, attributes get double quotes by default. After 4.21.0 attributes are missing the quotes.
<a href="path">Hello</a>
<a href=path>Hello</a>
Function guessQuotes in marko/packages/marko/src/runtime/html/helpers/attr.js has changed. In version <=4.20.2 guessQuotes normally returns doubleQuote, in later versions it doesn't.
npm i [email protected]
hello.marko with the following content:<a href="path">Hello</a>
main.js with the following content:require("marko/node-require");
const hello = require("./hello.marko");
console.log(hello.renderToString({}));
node main.js
Should output:
<a href=path>Hello</a>
N/A
This was a feature to decrease HTML output size (#1432). Is it causing problems for you?
Hello!
Yes, when we use these newer versions of Marko.js together with a library called Local-ESI for simulating Akamai ESI (https://www.npmjs.com/package/@bonniernews/local-esi) in our tests, the parsing of content returns unexpected results. We get missing first slashes "/some-path/" becomes "some-path/" and certain text within HTML tags end up in the wrong place.
This could be just Local-ESI doing things wrong, but we can't really test this in production with the real Akamai.
Removing single / double quotes is no small thing considering how many potential different parsers there are out there. We suggest an option for preserving double quotes where they were. An option like writeToDisk. What do you think about that? Maybe we could try to add it ourselves with a PR to you?
I鈥檓 only a contributor and not a Marko maintainer, so I can鈥檛 speak to how much they like that idea. But I suppose it can鈥檛 hurt to try.
If this doesn鈥檛 move fast enough for you though, it may also be worth trying to PR/fix that buggy quoteless value parsing in @bonniernews/local-esi or its underlying HTML parser, atlas-html-stream.
We can probably fix the issue with the esi-tags, but the safest way for us would be to continue with Marko rendering attributes values with quotes, as Marko did until 4.21. Changing the output format is risky, it can cause problem in other systems as well.
Adding an option "render attribute values with quotes" in Marko would be the best. @tigt , do you know who we can discuss this with? We can create a PR.
I believe the core team members are now @DylanPiercey, @mlrawlings, and @ryansolid
Thanks @tigt!
@tornord, is this still giving you problems? If you want to talk it over in a more immediate format, the Marko Discord is pretty active, especially after 1pm California time.
Hi, I'm having the same problem: '(
Hi there, this is a problem for us too... I would suggest an option (default=true) to define if marko shoud optimize quotes rendering.
Currently, Marko only targets spec-compliant HTML parsers and aims to produce the smallest HTML output given that.
I don't think we plan to change direction to output larger HTML for non-compliant parsers and tools.
Most helpful comment
Hi there, this is a problem for us too... I would suggest an option (default=true) to define if marko shoud optimize quotes rendering.