question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v4] Issue with inline style tag

See original GitHub issue

Bug 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:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
patrick-steele-idemcommented, Jan 13, 2017

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.

1reaction
patrick-steele-idemcommented, Jan 13, 2017

It looks to be a bug in Marko (specifically, template metadata). Internally, marko-magic is calling template.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:

[ { type: 'css',
    code: '\n.hello { color: green; }\n',
    virtualPath: '/Users/psteeleidem/temp/marko-style-tag-issue/client/components/counter/index.marko.css' } ]

NOTE: The index.marko file is not included as a dependency when it should be.

Without style tag:

[ { type: 'require',
    path: '/Users/psteeleidem/temp/marko-style-tag-issue/client/components/counter/index.marko' } ]

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found