We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
getComputedStyle()
<style> .parent p { color: black; } // this should take precedense, since it's more specific, according to CSS p { color: red; } </style>
The CSS specificity rules are described: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
var JSDOM = require("jsdom").JSDOM; const dom = new JSDOM(`<!DOCTYPE html> <style> div.parent p { color: black; } p { color: red; } </style> <div class="parent"> <p>Hi</p> </div> `); const style = dom.window.getComputedStyle(dom.window.document.querySelector("p")); console.log(style);
In every browser, getComputedStyle() returns color: black, in JSDOM it's color: red.
color: black
color: red
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Basic info:
The CSS specificity rules are described: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
Minimal reproduction case
How does similar code behave in browsers?
In every browser,
getComputedStyle()
returnscolor: black
, in JSDOM it'scolor: red
.The text was updated successfully, but these errors were encountered: