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

Add an alternative solution for computedStyleMap #37087

Open
thovo opened this issue Dec 4, 2024 · 0 comments
Open

Add an alternative solution for computedStyleMap #37087

thovo opened this issue Dec 4, 2024 · 0 comments
Labels
Content:WebAPI Web API docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.

Comments

@thovo
Copy link

thovo commented Dec 4, 2024

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Element/computedStyleMap

What specific section or headline is this issue about?

Alternative solution

What information was incorrect, unhelpful, or incomplete?

I found out that when I read information about computedStyleMap, I found no alternative solution or a polyfill suggestion to make the code run on Firefox or Safari. After digging in a little with my team, we found an equivalent solution:

const cssVariable = '--bs-spacer';
document.body.computedStyleMap().get(cssVariable); // In other browser like Chrome, Edge

// Equivalent in Firefox
window.getComputedStyle(document.body).getPropertyValue(cssVariable);

What did you expect to see?

I expect to see a Polyfill section or Alternative solution so any dev that jumps into the page can find out quickly a solution for their problem

Do you have any supporting links, references, or citations?

https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@thovo thovo added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Dec 4, 2024
@github-actions github-actions bot added the Content:WebAPI Web API docs label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.
Projects
None yet
Development

No branches or pull requests

1 participant