We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Marko seems to be dropping the closing ' of a quoted attribute value inside a script. See https://github.com/snyamathi/marko-repro/blob/master/template.marko#L6 as a concrete example / reproduction repo.
'
This seems to be a regression and did not happen until sometime recently. However, it might be something to do with Babel rather than Marko.
$ const foo = "bar" <script>window.baz='${foo}';</script>
It should render
<script>window.baz='bar';</script>
but it instead renders - note the closing ' is missing after 'bar
'bar
<script>window.baz='bar;</script>
Unsure, but this is the compiled Marko template for the above component
// Compiled using [email protected] - DO NOT EDIT "use strict"; exports.__esModule = true; exports.default = void 0; var _index = require("marko/dist/runtime/html/index.js"); var _renderer = _interopRequireDefault(require("marko/dist/runtime/components/renderer.js")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const _marko_componentType = "2pyMv7mw", _marko_template = (0, _index.t)(_marko_componentType); _marko_template.path = __filename; var _default = _marko_template; exports.default = _default; const _marko_component = {}; _marko_template._ = (0, _renderer.default)(function (input, out, _componentDef, _component, state, $global) { const foo = "bar"; out.w("<script>window.baz='bar;</script>"); }, { t: _marko_componentType, i: true }, _marko_component); _marko_template.meta = { id: _marko_componentType };
I'm also not sure that the '${foo}' syntax is correct. It works if I use JSON.strinfigy but that removes protection against closing the script tag.
'${foo}'
JSON.strinfigy
Clone the following repo and npm start. You'll notice that the markup that comes out of this is invalid and causes an error:
npm start
https://github.com/snyamathi/marko-repro/blob/master/template.marko#L6
$ curl localhost:8080 <body> <h1>Hello</h1> <script> window.name = "Frank; </script> ...
The text was updated successfully, but these errors were encountered:
marko-js/htmljs-parser#158 looks sus - pinning htmljs-parser to 5.4.1 fixes the issue cc @DylanPiercey
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Marko Version: 5.24.0
Details
Marko seems to be dropping the closing
'
of a quoted attribute value inside a script. See https://github.com/snyamathi/marko-repro/blob/master/template.marko#L6 as a concrete example / reproduction repo.This seems to be a regression and did not happen until sometime recently. However, it might be something to do with Babel rather than Marko.
Expected Behavior
It should render
but it instead renders - note the closing
'
is missing after'bar
Possible Fix
Unsure, but this is the compiled Marko template for the above component
I'm also not sure that the
'${foo}'
syntax is correct. It works if I useJSON.strinfigy
but that removes protection against closing the script tag.Additional Info
Your Environment
Steps to Reproduce
Clone the following repo and
npm start
. You'll notice that the markup that comes out of this is invalid and causes an error:https://github.com/snyamathi/marko-repro/blob/master/template.marko#L6
Stack Trace
The text was updated successfully, but these errors were encountered: