5

I fail to get the computed style value of color with jsdom:

require("jsdom").env({
    html: '<html><head><style> html { color: red; } </style></head><body></body></html>',
    done: function(errors, window) {

        console.log('color: "'+window.getComputedStyle(window.document.body).color+'"');
    }
});

The previous test returns "" instead of "rgb(255, 0, 0)" or "red" ...
(note that this work properly in a browser)

Do I miss something ?

leppie
  • 115,091
  • 17
  • 196
  • 297
Franck Freiburger
  • 26,310
  • 20
  • 70
  • 95

1 Answers1

6

It seems like jsdom does not implement inheritance for getComputedStyle.

If you get the computed style of the html tag it should work however.

Sebmaster
  • 539
  • 3
  • 5