Skip to content

window.getComputedStyle ignore important priority #2485

@maximzasorin

Description

@maximzasorin

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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    csshas to-upstream testThis bug has a failing to-upstream web platform test waiting to be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions