Basic info:
It seems that the getComputedStyle method ignores the important priority and always overrides the rules from the stylesheet with inline rules.
- Node.js version: 9.11.1
- jsdom version: 13.1.0
Minimal reproduction case
Next code print block instead of none.
const jsdom = require("jsdom");
const { JSDOM } = jsdom;
const { window } = new JSDOM(`<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
#testElement { display: none !important; }
</style>
</head>
<body>
<div id="testElement" style="display: block;"></div>
</body>
</html>`);
const element = window.document.querySelector("#testElement");
console.log(window.getComputedStyle(element).display);
How does similar code behave in browsers?
In browser getComputedStyle returns none.
http://jsfiddle.net/rygdnjws/
Basic info:
It seems that the
getComputedStylemethod ignores the important priority and always overrides the rules from the stylesheet with inline rules.Minimal reproduction case
Next code print
blockinstead ofnone.How does similar code behave in browsers?
In browser
getComputedStylereturnsnone.http://jsfiddle.net/rygdnjws/