Skip to content
New issue

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

All <svg> elements in page are colored black #584

Closed
rhysd opened this issue Oct 8, 2017 · 3 comments
Closed

All <svg> elements in page are colored black #584

rhysd opened this issue Oct 8, 2017 · 3 comments

Comments

@rhysd
Copy link
Contributor

rhysd commented Oct 8, 2017

Problem

I found a weird CSS rule in <style> element under <svg id="mermaidChartXXX"> element as following.

svg {
  color: rgb(0, 0, 0);
  font: normal normal normal normal 16px / normal "Hiragino Kaku Gothic ProN";
}

It colors all <svg> elements as black in an entire page overwriting other CSS rules.

How to reproduce

  1. Install mermaid with $ npm install mermaid
  2. Open example page with $ open node_modules/mermaid/dist/index.html
  3. Find <svg id="mermaidChart1"> element under <div class="mermaid">
  4. Check child <style> element's last CSS rule.

Environment

Followings are my environment information:

  • macOS 10.12.6
  • Chrome 61.0.3163.100
  • mermaid 7.1.0
@rhysd
Copy link
Contributor Author

rhysd commented Oct 8, 2017

This problem does not occur in mermaid 7.0.17 but occur in mermaid 7.0.18. So this is a regression.

@tylerlong
Copy link
Collaborator

Yes it is a regression.

In order to fix the problem from the root, we need to put mermaid CSS into its own namespace so it won't have any global pollution effect.

Example:

.mermad > svg {
...
}

@sclarson
Copy link

sclarson commented Nov 7, 2017

This looks like it is resolved by: #577

tigefa4u pushed a commit to tigefa4u/gitlabhq that referenced this issue Oct 22, 2018
This commit moves `mermaid` from blackst0ne-mermaid package to the
upstream version.

The reason why the fork was used was this bug[1].
The bug has been fixed, so there's no need to maintain my fork anymore.

[1]: mermaid-js/mermaid#584
mgenereu pushed a commit to mgenereu/mermaid that referenced this issue Jun 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants