[v4] Issue with inline style tag
See original GitHub issueBug Report
Context
<script>
module.exports = {
onInput(input) {
this.state = {
count: input.count
}
this.initialCount = input.count
},
incrementCount() {
this.state.count++
},
resetCount() {
this.state.count = this.initialCount
}
}
</script>
<style>
.hello { color: green; }
</style>
<div class="hello">And an example component! Current value: <b>${state.count}</b></div>
<button on-click('incrementCount')>+</button>
<button on-click('resetCount')>reset</button>
Expected Behavior
The text should be green, and clicking the +
button should increment the counter.
Actual Behavior
The text is green, but the +
button does nothing.
Hopefully it doesn’t have to do with my configuration 😃
Additional Info
Your Environment
- Version used: v4.0.0-rc.1
- Environment name and version: Chrome 54
- Operating System and version: OS X
- Link to your project:
Steps to Reproduce
Stack Trace
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Refused to apply inline style because it violates the following ...
I have to downvote this because, as sowbug says, allowing unsafe-inline is bad for security. "If an attacker can inject a script tag...
Read more >CSP issue with inline-style #19938 - mui/material-ui - GitHub
Update the CSP documentation for a setup to allow inline style attribute setting (not a great CSP, but would make Material-UIs stance clear...
Read more >inline-css - npm
When a data-embed attribute is present on a <style></style> tag, inline-css will not inline the styles and will not remove the <style></style> ...
Read more >Style Sheets in HTML documents - W3C
Setting the default style sheet language; Inline style information; Header style information: the STYLE element; Media types. External style sheets.
Read more >disable kirki-inline-styles - WordPress.org
This is a bug in v4, which doesn't exists in 3.x and this overrides embedded font-families of the child-theme. You will find simular...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fix from @mlrawlings verified. New version published with fix:
marko@4.0.0-rc.2
@mindeavor Please let us know if you see any other issues. Thanks, again.
It looks to be a bug in Marko (specifically, template metadata). Internally,
marko-magic
is callingtemplate.getDependencies()
to get the top-level page dependencies and this method is returning the incorrect value when the UI component has a<style>
tag:With style tag:
NOTE: The
index.marko
file is not included as a dependency when it should be.Without style tag:
ui-components-playground
is working fine because we are explicitly adding the top-level app UI component as a dependency for the top-level page.I’ll work with @mlrawlings to resolve this issue today. Thank you for reporting the problem!