Skip to content

Cannot set style.background with "/" for background-size in it #3169

@cdrini

Description

@cdrini

Basic info:

  • Node.js version: 15.12.0
  • jsdom version: 16.5.2

Minimal reproduction case

const { JSDOM } = require("jsdom");
const dom = new JSDOM(`<!DOCTYPE html><img>`);
const img = dom.window.document.querySelector("img");

img.style.background = 'url("foo.jpg") center/20px no-repeat';
console.log(img.style.background); // ""

img.style.background = 'url("foo.jpg") center no-repeat';
console.log(img.style.background); // 'url("foo.jpg") center no-repeat'

How does similar code behave in browsers?

  • On FF 87, it sets to: "rgba(0, 0, 0, 0) url(\"foo.jpg\") no-repeat scroll center center / 20px"
  • On Chrome, it sets to "url(\"foo.jpg\") center center / 20px no-repeat"

Here's a jsbin: https://jsbin.com/dokuhogabi/edit?html,js,console

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