marko-js / marko

A declarative, HTML-based language that makes building web apps fun
https://markojs.com/
MIT License
13.28k stars 641 forks source link

renderToString bug #1621

Closed tevel closed 3 years ago

tevel commented 3 years ago

Create new component with two files:

index.marko:

<span ${component.model.aaa}></span>

component.js:

module.exports = class {
    onCreate(input) {
        this.model = {aaa = 'bbb’};
    }
};

Render this component by using renderToString()

Expected results: Actual results:

"marko": "^4.23.9",

Workaround: change index.marko: <span bugFixPleaseDontRemove ${component.model.aaa}></span>

Actual results:

DylanPiercey commented 3 years ago

The dynamic attribute syntax is deprecated. Also with that syntax you are required to add the spacing yourself, eg ” bbb”.

Please switch to the modern spread attribute syntax which does not have this issue. https://markojs.com/docs/syntax/#dynamic-attributes

<span ...component.model.aaa></span>
tevel commented 3 years ago

cool, thank you!