Skip to content

Multiple background-images in CSS are not parsed by getComputedStyle #1166

@stuartlangridge

Description

@stuartlangridge
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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions