var jsdom = require("jsdom");
var pageHTML = '<!doctype html><html><head><style>\n' +
'p { background-image: url(http://example.com/foo); }\n' +
'div { background-image: url(http://example.com/foo), ' +
'url(http://example.com/bar); }\n' +
'</style>\n</head>\n<body><div></div><p></p></body></html>';
jsdom.env({
html: pageHTML,
done: function(err, window) {
console.log("One background-image works fine:",
window.getComputedStyle(
window.document.querySelector("p")).backgroundImage);
console.log("Two background-images does not parse:",
window.getComputedStyle(
window.document.querySelector("div")).backgroundImage);
}
});
Observe that the second line of the output does not print any background image, and it should.
Observe that the second line of the output does not print any background image, and it should.