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

Styles do not Inherit #2160

Open
Impally opened this issue Feb 26, 2018 · 2 comments
Open

Styles do not Inherit #2160

Impally opened this issue Feb 26, 2018 · 2 comments

Comments

@Impally
Copy link

Impally commented Feb 26, 2018

Basic info:

  • Node.js version: 6.11.1
  • jsdom version: 11.6.2

Minimal reproduction case

const { JSDOM } = require("jsdom");

const dom = new JSDOM(`
<style>
  body {
    color: Red;
  }
</style>hello world
<div class="divgroup" id="d1" style="padding-right: 5px;">Content for div 1</div>
`);

 dom.window.getComputedStyle(dom.window.document.querySelector('#d1'))
dom.window.getComputedStyle(dom.window.document.querySelector('#d1')).getPropertyValue('color')

How does similar code behave in browsers?

https://jsbin.com/cujumihabe/edit?html,js,console,output

The computed style for the div does not include the inherited color. That's the major issue, the other being that there are a large amount of things left out, and the color would not be translated to an rgb value, but I believe both of those are issues with cssom.

@domenic
Copy link
Member

domenic commented Feb 26, 2018

I think the issue is that we implement cascading, but not inheritance. Inheritance is harder :(.

@Impally Impally changed the title Styles do not Cascade Styles do not Inherit Feb 26, 2018
@TidyIQ
Copy link

TidyIQ commented May 10, 2019

Cascading isn't working properly if it is implemented.

getComputedStyle(element).getAttribute("color") returns #004ba0 instead of #2e7d32 in jsdom for this element: https://i.imgur.com/zYMaGPu.png

jcfranco added a commit to Esri/calcite-design-system that referenced this issue Sep 8, 2023
**Related Issue:** #6670 

## Summary

Adds support module for component responsiveness. 

### Notes

* Spec test is skipped until the following JSDOM issues are addressed:
  * jsdom/jsdom#3563
  * jsdom/jsdom#2160.
* Moves existing custom matchers from the color-picker E2E test to the
test utils module for reuse.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants